CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OraDbSchema.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_OraDbSchema_h
2 #define CondCore_CondDB_OraDbSchema_h
3 
7 #include "IDbSchema.h"
8 //
11 //
12 #include <boost/date_time/posix_time/posix_time.hpp>
13 
14 namespace cond {
15 
16  namespace persistency {
17 
18  class IOVCache {
19  public:
24  bool existsTag( const std::string& tag );
25  void addTag( const std::string& tag, const std::string token );
26  std::string getToken( const std::string& tag );
27  bool load( const std::string& tag );
29  m_validationMode = true;
30  }
32  return m_validationMode;
33  }
34  private:
38  bool m_validationMode = false;
39  };
40 
41  class OraTagTable : public ITagTable {
42  public:
43  explicit OraTagTable( IOVCache& cache );
44  virtual ~OraTagTable(){}
45  bool exists(){
46  return true;
47  }
48  void create(){
49  }
50 
51  bool select( const std::string& name );
52  bool select( const std::string& name, cond::TimeType& timeType, std::string& objectType, cond::SynchronizationType& synchronizationType,
53  cond::Time_t& endOfValidity, std::string& description, cond::Time_t& lastValidatedTime );
55  boost::posix_time::ptime& insertionTime, boost::posix_time::ptime& modificationTime );
56  void insert( const std::string& name, cond::TimeType timeType, const std::string& objectType,
57  cond::SynchronizationType synchronizationType, cond::Time_t endOfValidity, const std::string& description,
58  cond::Time_t lastValidatedTime, const boost::posix_time::ptime& insertionTime );
59  void update( const std::string& name, cond::Time_t& endOfValidity, const std::string& description,
60  cond::Time_t lastValidatedTime, const boost::posix_time::ptime& updateTime );
61  void updateValidity( const std::string& name, cond::Time_t lastValidatedTime,
62  const boost::posix_time::ptime& updateTime );
63  void setValidationMode();
64  private:
66  };
67 
68  class OraPayloadTable : public IPayloadTable {
69  public:
70  explicit OraPayloadTable( DbSession& session );
71  virtual ~OraPayloadTable(){}
72  bool exists(){
73  return true;
74  }
75  void create(){
76  }
77  bool select( const cond::Hash& payloadHash, std::string& objectType, cond::Binary& payloadData, cond::Binary& streamerInfoData );
78  bool getType( const cond::Hash& payloadHash, std::string& objectType );
79  cond::Hash insertIfNew( const std::string& objectType, const cond::Binary& payloadData,
80  const cond::Binary& streamerInfoData, const boost::posix_time::ptime& insertionTime );
81  private:
83  };
84 
85  class OraIOVTable : public IIOVTable {
86  public:
87  explicit OraIOVTable( IOVCache& cache );
88  virtual ~OraIOVTable(){}
89  bool exists(){
90  return true;
91  }
92  void create(){
93  }
94  size_t selectGroups( const std::string& tag, std::vector<cond::Time_t>& groups );
95  size_t selectSnapshotGroups( const std::string& tag, const boost::posix_time::ptime& snapshotTime,
96  std::vector<cond::Time_t>& groups );
97  size_t selectLatestByGroup( const std::string& tag, cond::Time_t lowerGroup, cond::Time_t upperGroup ,
98  std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs);
99  size_t selectSnapshotByGroup( const std::string& tag, cond::Time_t lowerGroup, cond::Time_t upperGroup,
100  const boost::posix_time::ptime& snapshotTime,
101  std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs);
102  size_t selectLatest( const std::string& tag, std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs);
103  size_t selectSnapshot( const std::string& tag, const boost::posix_time::ptime& snapshotTime, std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs);
104  bool getLastIov( const std::string& tag, cond::Time_t& since, cond::Hash& hash );
105  bool getSnapshotLastIov( const std::string& tag, const boost::posix_time::ptime& snapshotTime, cond::Time_t& since, cond::Hash& hash );
106  bool getSize( const std::string& tag, size_t& size );
107  bool getSnapshotSize( const std::string& tag, const boost::posix_time::ptime& snapshotTime, size_t& size );
108  void insertOne( const std::string& tag, cond::Time_t since, cond::Hash payloadHash,
109  const boost::posix_time::ptime& insertTime );
110  void insertMany( const std::string& tag,
111  const std::vector<std::tuple<cond::Time_t,cond::Hash,boost::posix_time::ptime> >& iovs );
112  void erase( const std::string& tag );
113  private:
115  };
116 
117  class OraIOVSchema : public IIOVSchema {
118  public:
119  explicit OraIOVSchema( DbSession& session );
120  virtual ~OraIOVSchema(){}
121  bool exists();
122  bool create();
123  ITagTable& tagTable();
124  IIOVTable& iovTable();
128  std::string parsePoolToken( const std::string& poolToken );
129  private:
134  };
135 
136  class OraGTTable : public IGTTable {
137  public:
138  explicit OraGTTable( DbSession& session );
139  virtual ~OraGTTable(){}
140  void create(){}
141  bool exists(){
142  return true;
143  }
144  bool select( const std::string& name );
145  bool select( const std::string& name, cond::Time_t& validity, boost::posix_time::ptime& snapshotTime );
146  bool select( const std::string& name, cond::Time_t& validity, std::string& description,
147  std::string& release, boost::posix_time::ptime& snapshotTime );
148  void insert( const std::string& name, cond::Time_t validity, const std::string& description, const std::string& release,
149  const boost::posix_time::ptime& snapshotTime, const boost::posix_time::ptime& insertionTime );
150  void update( const std::string& name, cond::Time_t validity, const std::string& description, const std::string& release,
151  const boost::posix_time::ptime& snapshotTime, const boost::posix_time::ptime& insertionTime );
152  private:
154  };
155 
156  class OraGTMapTable : public IGTMapTable {
157  public:
158  explicit OraGTMapTable( DbSession& session );
159  virtual ~OraGTMapTable(){}
160  void create(){}
161  bool exists(){
162  return true;
163  }
164  bool select( const std::string& gtName, std::vector<std::tuple<std::string,std::string,std::string> >& tags );
165  bool select( const std::string& gtName, const std::string& preFix, const std::string& postFix,
166  std::vector<std::tuple<std::string,std::string,std::string> >& tags );
167  void insert( const std::string& gtName, const std::vector<std::tuple<std::string,std::string,std::string> >& tags );
168  private:
170  };
171 
172  class OraGTSchema : public IGTSchema {
173  public:
175  virtual ~OraGTSchema(){}
176  void create();
177  bool exists();
178  IGTTable& gtTable();
180  private:
184  };
185 
186  }
187 }
188 #endif
bool select(const std::string &name)
Definition: OraDbSchema.cc:67
void update(const std::string &name, cond::Time_t validity, const std::string &description, const std::string &release, const boost::posix_time::ptime &snapshotTime, const boost::posix_time::ptime &insertionTime)
Definition: OraDbSchema.cc:349
bool getSnapshotSize(const std::string &tag, const boost::posix_time::ptime &snapshotTime, size_t &size)
Definition: OraDbSchema.cc:239
size_t selectGroups(const std::string &tag, std::vector< cond::Time_t > &groups)
Definition: OraDbSchema.cc:167
std::string getToken(const std::string &tag)
Definition: OraDbSchema.cc:38
bool getSnapshotLastIov(const std::string &tag, const boost::posix_time::ptime &snapshotTime, cond::Time_t &since, cond::Hash &hash)
Definition: OraDbSchema.cc:227
IPayloadTable & payloadTable()
Definition: OraDbSchema.cc:301
OraTagTable(IOVCache &cache)
Definition: OraDbSchema.cc:63
bool existsTag(const std::string &tag)
Definition: OraDbSchema.cc:33
cond::IOVEditor editor()
Definition: OraDbSchema.cc:29
cond::DbSession & session()
Definition: OraDbSchema.cc:21
bool select(const std::string &gtName, std::vector< std::tuple< std::string, std::string, std::string > > &tags)
Definition: OraDbSchema.cc:358
size_t selectSnapshot(const std::string &tag, const boost::posix_time::ptime &snapshotTime, std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)
Definition: OraDbSchema.cc:213
bool select(const std::string &name)
Definition: OraDbSchema.cc:324
void update(const std::string &name, cond::Time_t &endOfValidity, const std::string &description, cond::Time_t lastValidatedTime, const boost::posix_time::ptime &updateTime)
Definition: OraDbSchema.cc:106
void addTag(const std::string &tag, const std::string token)
Definition: OraDbSchema.cc:47
bool getLastIov(const std::string &tag, cond::Time_t &since, cond::Hash &hash)
Definition: OraDbSchema.cc:219
TimeType
Definition: Time.h:21
bool select(const cond::Hash &payloadHash, std::string &objectType, cond::Binary &payloadData, cond::Binary &streamerInfoData)
Definition: OraDbSchema.cc:129
OraGTTable(DbSession &session)
Definition: OraDbSchema.cc:320
void insert(const std::string &gtName, const std::vector< std::tuple< std::string, std::string, std::string > > &tags)
Definition: OraDbSchema.cc:377
unsigned long long Time_t
Definition: Time.h:16
cond::IOVProxy iovSequence()
Definition: OraDbSchema.cc:25
bool getMetadata(const std::string &name, std::string &description, boost::posix_time::ptime &insertionTime, boost::posix_time::ptime &modificationTime)
Definition: OraDbSchema.cc:87
OraIOVSchema(DbSession &session)
Definition: OraDbSchema.cc:278
void erase(const std::string &tag)
Definition: OraDbSchema.cc:273
std::string Hash
Definition: Types.h:47
bool load(const std::string &tag)
Definition: OraDbSchema.cc:56
bool getSize(const std::string &tag, size_t &size)
Definition: OraDbSchema.cc:233
void insertMany(const std::string &tag, const std::vector< std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > > &iovs)
Definition: OraDbSchema.cc:255
void insertOne(const std::string &tag, cond::Time_t since, cond::Hash payloadHash, const boost::posix_time::ptime &insertTime)
Definition: OraDbSchema.cc:244
size_t selectLatestByGroup(const std::string &tag, cond::Time_t lowerGroup, cond::Time_t upperGroup, std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)
Definition: OraDbSchema.cc:183
tuple tags
Definition: o2o.py:248
void insert(const std::string &name, cond::Time_t validity, const std::string &description, const std::string &release, const boost::posix_time::ptime &snapshotTime, const boost::posix_time::ptime &insertionTime)
Definition: OraDbSchema.cc:344
tuple description
Definition: idDealer.py:66
OraPayloadTable(DbSession &session)
Definition: OraDbSchema.cc:125
OraGTSchema(DbSession &session)
Definition: OraDbSchema.cc:381
bool getType(const cond::Hash &payloadHash, std::string &objectType)
Definition: OraDbSchema.cc:148
ITagMigrationTable & tagMigrationTable()
Definition: OraDbSchema.cc:305
SynchronizationType
Definition: Types.h:31
OraGTMapTable(DbSession &session)
Definition: OraDbSchema.cc:354
cond::IOVEditor m_iovAccess
Definition: OraDbSchema.h:35
size_t selectSnapshotByGroup(const std::string &tag, cond::Time_t lowerGroup, cond::Time_t upperGroup, const boost::posix_time::ptime &snapshotTime, std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)
Definition: OraDbSchema.cc:195
IPayloadMigrationTable & payloadMigrationTable()
Definition: OraDbSchema.cc:310
cond::Hash insertIfNew(const std::string &objectType, const cond::Binary &payloadData, const cond::Binary &streamerInfoData, const boost::posix_time::ptime &insertionTime)
Definition: OraDbSchema.cc:153
size_t selectSnapshotGroups(const std::string &tag, const boost::posix_time::ptime &snapshotTime, std::vector< cond::Time_t > &groups)
Definition: OraDbSchema.cc:177
size_t selectLatest(const std::string &tag, std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)
Definition: OraDbSchema.cc:202
void updateValidity(const std::string &name, cond::Time_t lastValidatedTime, const boost::posix_time::ptime &updateTime)
Definition: OraDbSchema.cc:116
std::string parsePoolToken(const std::string &poolToken)
Definition: OraDbSchema.cc:315
tuple size
Write out results.
void insert(const std::string &name, cond::TimeType timeType, const std::string &objectType, cond::SynchronizationType synchronizationType, cond::Time_t endOfValidity, const std::string &description, cond::Time_t lastValidatedTime, const boost::posix_time::ptime &insertionTime)
Definition: OraDbSchema.cc:96
IOVCache(cond::DbSession &s)
Definition: OraDbSchema.cc:17