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  bool getLastIov( const std::string& tag, cond::Time_t& since, cond::Hash& hash );
104  bool getSize( const std::string& tag, size_t& size );
105  bool getSnapshotSize( const std::string& tag, const boost::posix_time::ptime& snapshotTime, size_t& size );
106  void insertOne( const std::string& tag, cond::Time_t since, cond::Hash payloadHash,
107  const boost::posix_time::ptime& insertTime );
108  void insertMany( const std::string& tag,
109  const std::vector<std::tuple<cond::Time_t,cond::Hash,boost::posix_time::ptime> >& iovs );
110  void erase( const std::string& tag );
111  private:
113  };
114 
115  class OraIOVSchema : public IIOVSchema {
116  public:
117  explicit OraIOVSchema( DbSession& session );
118  virtual ~OraIOVSchema(){}
119  bool exists();
120  bool create();
121  ITagTable& tagTable();
122  IIOVTable& iovTable();
126  std::string parsePoolToken( const std::string& poolToken );
127  private:
132  };
133 
134  class OraGTTable : public IGTTable {
135  public:
136  explicit OraGTTable( DbSession& session );
137  virtual ~OraGTTable(){}
138  bool exists(){
139  return true;
140  }
141  bool select( const std::string& name );
142  bool select( const std::string& name, cond::Time_t& validity, boost::posix_time::ptime& snapshotTime );
143  bool select( const std::string& name, cond::Time_t& validity, std::string& description,
144  std::string& release, boost::posix_time::ptime& snapshotTime );
145  void insert( const std::string& name, cond::Time_t validity, const std::string& description, const std::string& release,
146  const boost::posix_time::ptime& snapshotTime, const boost::posix_time::ptime& insertionTime );
147  void update( const std::string& name, cond::Time_t validity, const std::string& description, const std::string& release,
148  const boost::posix_time::ptime& snapshotTime, const boost::posix_time::ptime& insertionTime );
149  private:
151  };
152 
153  class OraGTMapTable : public IGTMapTable {
154  public:
155  explicit OraGTMapTable( DbSession& session );
156  virtual ~OraGTMapTable(){}
157  bool exists(){
158  return true;
159  }
160  bool select( const std::string& gtName, std::vector<std::tuple<std::string,std::string,std::string> >& tags );
161  bool select( const std::string& gtName, const std::string& preFix, const std::string& postFix,
162  std::vector<std::tuple<std::string,std::string,std::string> >& tags );
163  void insert( const std::string& gtName, const std::vector<std::tuple<std::string,std::string,std::string> >& tags );
164  private:
166  };
167 
168  class OraGTSchema : public IGTSchema {
169  public:
171  virtual ~OraGTSchema(){}
172  bool exists();
173  IGTTable& gtTable();
175  private:
179  };
180 
181  }
182 }
183 #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:337
bool getSnapshotSize(const std::string &tag, const boost::posix_time::ptime &snapshotTime, size_t &size)
Definition: OraDbSchema.cc:227
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
IPayloadTable & payloadTable()
Definition: OraDbSchema.cc:289
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:346
bool select(const std::string &name)
Definition: OraDbSchema.cc:312
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:213
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:308
void insert(const std::string &gtName, const std::vector< std::tuple< std::string, std::string, std::string > > &tags)
Definition: OraDbSchema.cc:365
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:266
void erase(const std::string &tag)
Definition: OraDbSchema.cc:261
std::string Hash
Definition: Types.h:43
bool load(const std::string &tag)
Definition: OraDbSchema.cc:56
bool getSize(const std::string &tag, size_t &size)
Definition: OraDbSchema.cc:221
void insertMany(const std::string &tag, const std::vector< std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > > &iovs)
Definition: OraDbSchema.cc:243
void insertOne(const std::string &tag, cond::Time_t since, cond::Hash payloadHash, const boost::posix_time::ptime &insertTime)
Definition: OraDbSchema.cc:232
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:332
tuple description
Definition: idDealer.py:66
OraPayloadTable(DbSession &session)
Definition: OraDbSchema.cc:125
OraGTSchema(DbSession &session)
Definition: OraDbSchema.cc:369
bool getType(const cond::Hash &payloadHash, std::string &objectType)
Definition: OraDbSchema.cc:148
ITagMigrationTable & tagMigrationTable()
Definition: OraDbSchema.cc:293
SynchronizationType
Definition: Types.h:31
OraGTMapTable(DbSession &session)
Definition: OraDbSchema.cc:342
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:298
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:303
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