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,
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
cond::persistency::IOVSchema::exists
bool exists() override
Definition: IOVSchema.cc:555
cond::persistency::IOVSchema::m_tagTable
TAG::Table m_tagTable
Definition: IOVSchema.h:260
cond::persistency::TAG_AUTHORIZATION::TAG_NAME
Definition: IOVSchema.h:190
cond::persistency::PAYLOAD::DATA
Definition: IOVSchema.h:78
cond::persistency::IOV::MAX_SINCE
Definition: IOVSchema.h:141
cond::persistency::TAG_AUTHORIZATION::Table::m_schema
coral::ISchema & m_schema
Definition: IOVSchema.h:215
cond::persistency::TAG_LOG::USER_NAME
Definition: IOVSchema.h:222
cond::TimeType
TimeType
Definition: Time.h:19
cond::persistency::IOV::SINCE
Definition: IOVSchema.h:112
cond::persistency::TAG_LOG::Table::~Table
~Table() override
Definition: IOVSchema.h:231
cond::Hash
std::string Hash
Definition: Types.h:43
cond::persistency::TAG_AUTHORIZATION::CREDENTIAL_TYPE
Definition: IOVSchema.h:193
cond::Binary
Definition: Binary.h:15
cond::persistency::IOV::SINCE_GROUP
Definition: IOVSchema.h:116
cond::hash
Definition: Time.h:19
cond::persistency::IOV::MIN_SINCE::tableName
static std::string tableName()
Definition: IOVSchema.h:137
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
cond::persistency::ITagAccessPermissionTable
Definition: IDbSchema.h:108
singleTopDQM_cfi.select
select
Definition: singleTopDQM_cfi.py:50
cond::persistency::IOV::MIN_SINCE::type
cond::Time_t type
Definition: IOVSchema.h:135
cond::persistency::IOVSchema::~IOVSchema
~IOVSchema() override
Definition: IOVSchema.h:250
cond::persistency::PAYLOAD::PAYLOAD_HASH_SIZE
static constexpr unsigned int PAYLOAD_HASH_SIZE
Definition: IOVSchema.h:74
cond::persistency::IOVSchema::m_payloadTable
PAYLOAD::Table m_payloadTable
Definition: IOVSchema.h:264
loadRecoTauTagMVAsFromPrepDB_cfi.snapshotTime
snapshotTime
Definition: loadRecoTauTagMVAsFromPrepDB_cfi.py:10
cond::persistency::TAG::Table::~Table
~Table() override
Definition: IOVSchema.h:28
cond::persistency::IOV::MAX_SINCE::type
cond::Time_t type
Definition: IOVSchema.h:142
cond::persistency::TAG_LOG::TAG_NAME
Definition: IOVSchema.h:220
cond::persistency::IOV::MAX_SINCE::tableName
static std::string tableName()
Definition: IOVSchema.h:144
cond::persistency::IIOVSchema
Definition: IDbSchema.h:141
cond::persistency::TAG::Table
Definition: IOVSchema.h:25
cond::persistency::TAG_LOG::EVENT_TIME
Definition: IOVSchema.h:221
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
cond::persistency::IOVSchema::m_tagLogTable
TAG_LOG::Table m_tagLogTable
Definition: IOVSchema.h:262
cond::persistency::TAG::MODIFICATION_TIME
Definition: IOVSchema.h:22
cond::persistency::IOVSchema::tagLogTable
ITagLogTable & tagLogTable() override
Definition: IOVSchema.cc:582
mps_check.command
list command
Definition: mps_check.py:25
cond::persistency::IOV::SEQUENCE_SIZE::type
unsigned int type
Definition: IOVSchema.h:128
HLT_Fake1_cff.tableName
tableName
Definition: HLT_Fake1_cff.py:10
EcalCondDBWriter_cfi.userName
userName
Definition: EcalCondDBWriter_cfi.py:61
conddb_column
#define conddb_column(...)
Definition: DbCore.h:76
cond::persistency::IOV::Table::~Table
~Table() override
Definition: IOVSchema.h:151
cond::persistency::PAYLOAD::STREAMER_INFO
Definition: IOVSchema.h:79
cond::persistency::IOVSchema::tagAccessPermissionTable
ITagAccessPermissionTable & tagAccessPermissionTable() override
Definition: IOVSchema.cc:584
cond::persistency::TAG::END_OF_VALIDITY
Definition: IOVSchema.h:18
cond::persistency::TAG::LAST_VALIDATED_TIME
Definition: IOVSchema.h:20
cond::persistency::TAG_AUTHORIZATION::CREDENTIAL
Definition: IOVSchema.h:192
cond::persistency::IOV::INSERTION_TIME
Definition: IOVSchema.h:114
cond::persistency::IOV::PAYLOAD_HASH
Definition: IOVSchema.h:113
cond::persistency::IPayloadTable
Definition: IDbSchema.h:55
cond::persistency::IOVSchema::create
bool create() override
Definition: IOVSchema.cc:565
cond::SynchronizationType
SynchronizationType
Definition: Types.h:27
cond::persistency::PAYLOAD::Table::m_schema
coral::ISchema & m_schema
Definition: IOVSchema.h:106
cond::persistency::IOVSchema::payloadTable
IPayloadTable & payloadTable() override
Definition: IOVSchema.cc:591
cond::persistency::IOV::SEQUENCE_SIZE::fullyQualifiedName
static std::string fullyQualifiedName()
Definition: IOVSchema.h:131
mps_fire.end
end
Definition: mps_fire.py:242
writeEcalDQMStatus.since
since
Definition: writeEcalDQMStatus.py:53
cond::persistency::TAG::DESCRIPTION
Definition: IOVSchema.h:19
cond::persistency::IOV::SINCE_GROUP::group
static std::string group(unsigned long long groupSize)
Definition: IOVSchema.h:121
cond::persistency::TAG_LOG::USER_TEXT
Definition: IOVSchema.h:226
cond::persistency::TAG::PROTECTION_CODE
Definition: IOVSchema.h:23
cond::persistency::TAG_LOG::Table::m_schema
coral::ISchema & m_schema
Definition: IOVSchema.h:243
cond::persistency::IOV::Table::m_schema
coral::ISchema & m_schema
Definition: IOVSchema.h:185
cond::persistency::PAYLOAD::VERSION
Definition: IOVSchema.h:80
cond::persistency::TAG_AUTHORIZATION::ACCESS_TYPE
Definition: IOVSchema.h:191
cond::persistency::PAYLOAD::HASH
Definition: IOVSchema.h:76
cond::persistency::TAG_AUTHORIZATION::Table
Definition: IOVSchema.h:195
cond
Definition: plugin.cc:23
cond::persistency::IOV::SEQUENCE_SIZE
Definition: IOVSchema.h:127
cond::persistency::TAG_AUTHORIZATION::Table::~Table
~Table() override
Definition: IOVSchema.h:198
EcalCondDBWriter_cfi.hostName
hostName
Definition: EcalCondDBWriter_cfi.py:59
cond::persistency::IOV::MAX_SINCE::fullyQualifiedName
static std::string fullyQualifiedName()
Definition: IOVSchema.h:145
makeGlobalPositionRcd_cfg.tag
tag
Definition: makeGlobalPositionRcd_cfg.py:6
cond::persistency::TAG::Table::m_schema
coral::ISchema & m_schema
Definition: IOVSchema.h:68
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
DbCore.h
cond::persistency::IOV::SINCE_GROUP::fullyQualifiedName
static std::string fullyQualifiedName()
Definition: IOVSchema.h:120
cond::persistency::TAG_LOG::COMMAND
Definition: IOVSchema.h:224
writedatasetfile.action
action
Definition: writedatasetfile.py:8
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
cond::persistency::IOV::TAG_NAME
Definition: IOVSchema.h:111
cond::persistency::PAYLOAD::Table
Definition: IOVSchema.h:83
cond::persistency::PAYLOAD::Table::~Table
~Table() override
Definition: IOVSchema.h:86
cond::persistency::ITagTable
Definition: IDbSchema.h:15
cond::persistency::PAYLOAD::INSERTION_TIME
Definition: IOVSchema.h:81
conddb_table
#define conddb_table(NAME)
Definition: DbCore.h:49
cond::persistency::IOV::SEQUENCE_SIZE::tableName
static std::string tableName()
Definition: IOVSchema.h:130
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::TAG_LOG::ACTION
Definition: IOVSchema.h:225
cond::persistency::TAG::OBJECT_TYPE
Definition: IOVSchema.h:16
cond::persistency::IOVSchema::IOVSchema
IOVSchema(coral::ISchema &schema)
Definition: IOVSchema.cc:548
cond::persistency::ITagLogTable
Definition: IDbSchema.h:127
cond::persistency::TAG::Table::isProtectable
bool isProtectable()
Definition: IOVSchema.h:65
cond::persistency::TAG_LOG::Table
Definition: IOVSchema.h:228
cond::persistency::IOVSchema::iovTable
IIOVTable & iovTable() override
Definition: IOVSchema.cc:580
cond::persistency::IIOVTable
Definition: IDbSchema.h:71
cond::persistency::IOV::SINCE_GROUP::tableName
static std::string tableName()
Definition: IOVSchema.h:119
edm::eventsetup::heterocontainer::insert
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
cond::persistency::IOV::SINCE_GROUP::type
cond::Time_t type
Definition: IOVSchema.h:117
IDbSchema.h
pixel_dqm_sourceclient-live_cfg.TAG
TAG
Definition: pixel_dqm_sourceclient-live_cfg.py:19
cond::persistency::IOV::MIN_SINCE::fullyQualifiedName
static std::string fullyQualifiedName()
Definition: IOVSchema.h:138
cond::persistency::IOVSchema::tagTable
ITagTable & tagTable() override
Definition: IOVSchema.cc:578
cond::persistency::IOV::Table
Definition: IOVSchema.h:148
cond::persistency::TAG::INSERTION_TIME
Definition: IOVSchema.h:21
cond::persistency::IOVSchema::m_iovTable
IOV::Table m_iovTable
Definition: IOVSchema.h:261
cond::persistency::TAG::SYNCHRONIZATION
Definition: IOVSchema.h:17
cond::persistency::IOVSchema::m_tagAccessPermissionTable
TAG_AUTHORIZATION::Table m_tagAccessPermissionTable
Definition: IOVSchema.h:263
cond::persistency::TAG::TIME_TYPE
Definition: IOVSchema.h:15
JetPartonCorrections_cff.tagName
tagName
Definition: JetPartonCorrections_cff.py:12
cond::persistency::PAYLOAD::OBJECT_TYPE
Definition: IOVSchema.h:77
cond::persistency::TAG::NAME
Definition: IOVSchema.h:14
cond::persistency::TAG_LOG::HOST_NAME
Definition: IOVSchema.h:223
cond::persistency::IOV::MIN_SINCE
Definition: IOVSchema.h:134
update
#define update(a, b)
Definition: TrackClassifier.cc:10
cond::persistency::IOVSchema
Definition: IOVSchema.h:247
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443