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();
125  private:
130  };
131 
132  class OraGTTable : public IGTTable {
133  public:
134  explicit OraGTTable( DbSession& session );
135  virtual ~OraGTTable(){}
136  bool exists(){
137  return true;
138  }
139  bool select( const std::string& name );
140  bool select( const std::string& name, cond::Time_t& validity, boost::posix_time::ptime& snapshotTime );
141  bool select( const std::string& name, cond::Time_t& validity, std::string& description,
142  std::string& release, boost::posix_time::ptime& snapshotTime );
143  void insert( const std::string& name, cond::Time_t validity, const std::string& description, const std::string& release,
144  const boost::posix_time::ptime& snapshotTime, const boost::posix_time::ptime& insertionTime );
145  void update( 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  private:
149  };
150 
151  class OraGTMapTable : public IGTMapTable {
152  public:
153  explicit OraGTMapTable( DbSession& session );
154  virtual ~OraGTMapTable(){}
155  bool exists(){
156  return true;
157  }
158  bool select( const std::string& gtName, std::vector<std::tuple<std::string,std::string,std::string> >& tags );
159  bool select( const std::string& gtName, const std::string& preFix, const std::string& postFix,
160  std::vector<std::tuple<std::string,std::string,std::string> >& tags );
161  void insert( const std::string& gtName, const std::vector<std::tuple<std::string,std::string,std::string> >& tags );
162  private:
164  };
165 
166  class OraGTSchema : public IGTSchema {
167  public:
169  virtual ~OraGTSchema(){}
170  bool exists();
171  IGTTable& gtTable();
173  private:
177  };
178 
179  }
180 }
181 #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:308
bool getSnapshotSize(const std::string &tag, const boost::posix_time::ptime &snapshotTime, size_t &size)
Definition: OraDbSchema.cc:218
size_t selectGroups(const std::string &tag, std::vector< cond::Time_t > &groups)
Definition: OraDbSchema.cc:158
std::string getToken(const std::string &tag)
Definition: OraDbSchema.cc:38
IPayloadTable & payloadTable()
Definition: OraDbSchema.cc:270
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:317
bool select(const std::string &name)
Definition: OraDbSchema.cc:283
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:105
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:204
TimeType
Definition: Time.h:21
bool select(const cond::Hash &payloadHash, std::string &objectType, cond::Binary &payloadData, cond::Binary &streamerInfoData)
Definition: OraDbSchema.cc:128
OraGTTable(DbSession &session)
Definition: OraDbSchema.cc:279
void insert(const std::string &gtName, const std::vector< std::tuple< std::string, std::string, std::string > > &tags)
Definition: OraDbSchema.cc:336
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:247
void erase(const std::string &tag)
Definition: OraDbSchema.cc:242
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:212
void insertMany(const std::string &tag, const std::vector< std::tuple< cond::Time_t, cond::Hash, boost::posix_time::ptime > > &iovs)
Definition: OraDbSchema.cc:230
void insertOne(const std::string &tag, cond::Time_t since, cond::Hash payloadHash, const boost::posix_time::ptime &insertTime)
Definition: OraDbSchema.cc:223
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:174
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:303
tuple description
Definition: idDealer.py:66
OraPayloadTable(DbSession &session)
Definition: OraDbSchema.cc:124
OraGTSchema(DbSession &session)
Definition: OraDbSchema.cc:340
bool getType(const cond::Hash &payloadHash, std::string &objectType)
Definition: OraDbSchema.cc:139
ITagMigrationTable & tagMigrationTable()
Definition: OraDbSchema.cc:274
SynchronizationType
Definition: Types.h:31
OraGTMapTable(DbSession &session)
Definition: OraDbSchema.cc:313
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:186
cond::Hash insertIfNew(const std::string &objectType, const cond::Binary &payloadData, const cond::Binary &streamerInfoData, const boost::posix_time::ptime &insertionTime)
Definition: OraDbSchema.cc:144
size_t selectSnapshotGroups(const std::string &tag, const boost::posix_time::ptime &snapshotTime, std::vector< cond::Time_t > &groups)
Definition: OraDbSchema.cc:168
size_t selectLatest(const std::string &tag, std::vector< std::tuple< cond::Time_t, cond::Hash > > &iovs)
Definition: OraDbSchema.cc:193
void updateValidity(const std::string &name, cond::Time_t lastValidatedTime, const boost::posix_time::ptime &updateTime)
Definition: OraDbSchema.cc:115
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:95
IOVCache(cond::DbSession &s)
Definition: OraDbSchema.cc:17