CMS 3D CMS Logo

IOVSchema.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_IOVSchema_h
2 #define CondCore_CondDB_IOVSchema_h
3 
4 #include "DbCore.h"
5 #include "IDbSchema.h"
6 //
7 #include <boost/date_time/posix_time/posix_time.hpp>
8 
9 namespace cond {
10 
11  namespace persistency {
12 
21  conddb_column(INSERTION_TIME, boost::posix_time::ptime);
22  conddb_column(MODIFICATION_TIME, boost::posix_time::ptime);
24 
25  class Table : public ITagTable {
26  public:
27  explicit Table(coral::ISchema& schema);
28  ~Table() override {}
29  bool exists() override;
30  void create() override;
31  bool select(const std::string& name) override;
32  bool select(const std::string& name,
33  cond::TimeType& timeType,
34  std::string& objectType,
35  cond::SynchronizationType& synchronizationType,
36  cond::Time_t& endOfValidity,
37  cond::Time_t& lastValidatedTime,
38  int& protectionCode) override;
39  bool getMetadata(const std::string& name,
41  boost::posix_time::ptime& insertionTime,
42  boost::posix_time::ptime& modificationTime) override;
43  void insert(const std::string& name,
44  cond::TimeType timeType,
45  const std::string& objectType,
46  cond::SynchronizationType synchronizationType,
47  cond::Time_t endOfValidity,
48  const std::string& description,
49  cond::Time_t lastValidatedTime,
50  const boost::posix_time::ptime& insertionTime) override;
51  void update(const std::string& name,
52  cond::SynchronizationType synchronizationType,
53  cond::Time_t& endOfValidity,
54  cond::Time_t lastValidatedTime,
55  const boost::posix_time::ptime& updateTime) override;
56  void updateMetadata(const std::string& name,
57  const std::string& description,
58  const boost::posix_time::ptime& updateTime) override;
59  void updateValidity(const std::string& name,
60  cond::Time_t lastValidatedTime,
61  const boost::posix_time::ptime& updateTime) override;
62  void setProtectionCode(const std::string& name, int code) override;
63  void unsetProtectionCode(const std::string& name, int code) override;
64 
65  bool isProtectable() { return m_isProtectable; }
66 
67  private:
68  coral::ISchema& m_schema;
69  bool m_isProtectable = false;
70  };
71  }
72 
73  conddb_table(PAYLOAD) {
74  static constexpr unsigned int PAYLOAD_HASH_SIZE = 40;
75 
81  conddb_column(INSERTION_TIME, boost::posix_time::ptime);
82 
83  class Table : public IPayloadTable {
84  public:
85  explicit Table(coral::ISchema& schema);
86  ~Table() override {}
87  bool exists() override;
88  void create() override;
89  bool select(const cond::Hash& payloadHash);
90  bool select(const cond::Hash& payloadHash,
91  std::string& objectType,
92  cond::Binary& payloadData,
93  cond::Binary& streamerInfoData) override;
94  bool getType(const cond::Hash& payloadHash, std::string& objectType) override;
95  bool insert(const cond::Hash& payloadHash,
96  const std::string& objectType,
97  const cond::Binary& payloadData,
98  const cond::Binary& streamerInfoData,
99  const boost::posix_time::ptime& insertionTime);
100  cond::Hash insertIfNew(const std::string& objectType,
101  const cond::Binary& payloadData,
102  const cond::Binary& streamerInfoData,
103  const boost::posix_time::ptime& insertionTime) override;
104 
105  private:
106  coral::ISchema& m_schema;
107  };
108  }
109 
114  conddb_column(INSERTION_TIME, boost::posix_time::ptime);
115 
116  struct SINCE_GROUP {
118  static constexpr size_t size = 0;
119  static std::string tableName() { return SINCE::tableName(); }
120  static std::string fullyQualifiedName() { return "MIN(" + SINCE::fullyQualifiedName() + ")"; }
121  static std::string group(unsigned long long groupSize) {
122  std::string sgroupSize = std::to_string(groupSize);
123  return "CAST(" + SINCE::fullyQualifiedName() + "/" + sgroupSize + " AS INT )*" + sgroupSize;
124  }
125  };
126 
127  struct SEQUENCE_SIZE {
128  typedef unsigned int type;
129  static constexpr size_t size = 0;
130  static std::string tableName() { return SINCE::tableName(); }
131  static std::string fullyQualifiedName() { return "COUNT(*)"; }
132  };
133 
134  struct MIN_SINCE {
136  static constexpr size_t size = 0;
137  static std::string tableName() { return SINCE::tableName(); }
138  static std::string fullyQualifiedName() { return "MIN(" + SINCE::fullyQualifiedName() + ")"; }
139  };
140 
141  struct MAX_SINCE {
143  static constexpr size_t size = 0;
144  static std::string tableName() { return SINCE::tableName(); }
145  static std::string fullyQualifiedName() { return "MAX(" + SINCE::fullyQualifiedName() + ")"; }
146  };
147 
148  class Table : public IIOVTable {
149  public:
150  explicit Table(coral::ISchema& schema);
151  ~Table() override {}
152  bool exists() override;
153  void create() override;
154  size_t getGroups(const std::string& tag,
155  const boost::posix_time::ptime& snapshotTime,
156  unsigned long long groupSize,
157  std::vector<cond::Time_t>& groups) override;
158  size_t select(const std::string& tag,
159  cond::Time_t lowerGroup,
160  cond::Time_t upperGroup,
161  const boost::posix_time::ptime& snapshotTime,
162  std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override;
163  bool getLastIov(const std::string& tag,
164  const boost::posix_time::ptime& snapshotTime,
166  cond::Hash& hash) override;
167  bool getSize(const std::string& tag, const boost::posix_time::ptime& snapshotTime, size_t& size) override;
168  bool getRange(const std::string& tag,
169  cond::Time_t begin,
170  cond::Time_t end,
171  const boost::posix_time::ptime& snapshotTime,
172  std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override;
173  void insertOne(const std::string& tag,
175  cond::Hash payloadHash,
176  const boost::posix_time::ptime& insertTime) override;
177  void insertMany(
178  const std::string& tag,
179  const std::vector<std::tuple<cond::Time_t, cond::Hash, boost::posix_time::ptime> >& iovs) override;
180  void eraseOne(const std::string& tag, cond::Time_t since, cond::Hash payloadId) override;
181  void eraseMany(const std::string& tag, const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override;
182  void erase(const std::string& tag) override;
183 
184  private:
185  coral::ISchema& m_schema;
186  };
187  }
188 
189  conddb_table(TAG_AUTHORIZATION) {
194 
196  public:
197  explicit Table(coral::ISchema& schema);
198  ~Table() override {}
199  bool exists() override;
200  void create() override;
201  bool getAccessPermission(const std::string& tagName,
202  const std::string& credential,
203  int credentialType,
204  int accessType) override;
205  void setAccessPermission(const std::string& tagName,
206  const std::string& credential,
207  int credentialType,
208  int accessType) override;
209  void removeAccessPermission(const std::string& tagName,
210  const std::string& credential,
211  int credentialType) override;
212  void removeEntriesForCredential(const std::string& credential, int credentialType) override;
213 
214  private:
215  coral::ISchema& m_schema;
216  };
217  }
218 
219  conddb_table(TAG_LOG) {
221  conddb_column(EVENT_TIME, boost::posix_time::ptime);
227 
228  class Table : public ITagLogTable {
229  public:
230  explicit Table(coral::ISchema& schema);
231  ~Table() override {}
232  bool exists() override;
233  void create() override;
234  void insert(const std::string& tag,
235  const boost::posix_time::ptime& eventTime,
236  const std::string& userName,
237  const std::string& hostName,
238  const std::string& command,
239  const std::string& action,
240  const std::string& userText) override;
241 
242  private:
243  coral::ISchema& m_schema;
244  };
245  }
246 
247  class IOVSchema : public IIOVSchema {
248  public:
249  explicit IOVSchema(coral::ISchema& schema);
250  ~IOVSchema() override {}
251  bool exists() override;
252  bool create() override;
253  ITagTable& tagTable() override;
254  IIOVTable& iovTable() override;
255  ITagLogTable& tagLogTable() override;
257  IPayloadTable& payloadTable() override;
258 
259  private:
265  };
266 
267  } // namespace persistency
268 } // namespace cond
269 #endif
size
Write out results.
static std::string tableName()
Definition: IOVSchema.h:144
def create(alignables, pedeDump, additionalData, outputFile, config)
std::string to_string(const V &value)
Definition: OMSAccess.h:77
static constexpr unsigned int PAYLOAD_HASH_SIZE
Definition: IOVSchema.h:74
static std::string tableName()
Definition: IOVSchema.h:137
#define conddb_column(...)
Definition: DbCore.h:76
PAYLOAD::Table m_payloadTable
Definition: IOVSchema.h:264
coral::ISchema & m_schema
Definition: IOVSchema.h:68
TimeType
Definition: Time.h:19
static std::string group(unsigned long long groupSize)
Definition: IOVSchema.h:121
IPayloadTable & payloadTable() override
Definition: IOVSchema.cc:596
coral::ISchema & m_schema
Definition: IOVSchema.h:185
TAG_AUTHORIZATION::Table m_tagAccessPermissionTable
Definition: IOVSchema.h:263
unsigned long long Time_t
Definition: Time.h:14
std::string Hash
Definition: Types.h:43
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
ITagLogTable & tagLogTable() override
Definition: IOVSchema.cc:587
static std::string fullyQualifiedName()
Definition: IOVSchema.h:145
static std::string tableName()
Definition: IOVSchema.h:119
static std::string tableName()
Definition: IOVSchema.h:130
TAG_LOG::Table m_tagLogTable
Definition: IOVSchema.h:262
static std::string fullyQualifiedName()
Definition: IOVSchema.h:120
IOVSchema(coral::ISchema &schema)
Definition: IOVSchema.cc:553
static std::string fullyQualifiedName()
Definition: IOVSchema.h:131
list command
Definition: mps_check.py:25
Definition: plugin.cc:23
#define update(a, b)
SynchronizationType
Definition: Types.h:27
IIOVTable & iovTable() override
Definition: IOVSchema.cc:585
ITagAccessPermissionTable & tagAccessPermissionTable() override
Definition: IOVSchema.cc:589
ITagTable & tagTable() override
Definition: IOVSchema.cc:583
#define conddb_table(NAME)
Definition: DbCore.h:49
static std::string fullyQualifiedName()
Definition: IOVSchema.h:138