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);
23 
24  class Table : public ITagTable {
25  public:
26  explicit Table(coral::ISchema& schema);
27  ~Table() override {}
28  bool exists() override;
29  void create() override;
30  bool select(const std::string& name) override;
31  bool select(const std::string& name,
32  cond::TimeType& timeType,
33  std::string& objectType,
34  cond::SynchronizationType& synchronizationType,
35  cond::Time_t& endOfValidity,
36  cond::Time_t& lastValidatedTime) override;
37  bool getMetadata(const std::string& name,
39  boost::posix_time::ptime& insertionTime,
40  boost::posix_time::ptime& modificationTime) override;
41  void insert(const std::string& name,
42  cond::TimeType timeType,
43  const std::string& objectType,
44  cond::SynchronizationType synchronizationType,
45  cond::Time_t endOfValidity,
46  const std::string& description,
47  cond::Time_t lastValidatedTime,
48  const boost::posix_time::ptime& insertionTime) override;
49  void update(const std::string& name,
50  cond::SynchronizationType synchronizationType,
51  cond::Time_t& endOfValidity,
52  cond::Time_t lastValidatedTime,
53  const boost::posix_time::ptime& updateTime) override;
54  void updateMetadata(const std::string& name,
55  const std::string& description,
56  const boost::posix_time::ptime& updateTime) override;
57  void updateValidity(const std::string& name,
58  cond::Time_t lastValidatedTime,
59  const boost::posix_time::ptime& updateTime) override;
60  void setValidationMode() override {}
61 
62  private:
63  coral::ISchema& m_schema;
64  };
65  }
66 
67  conddb_table(PAYLOAD) {
68  static constexpr unsigned int PAYLOAD_HASH_SIZE = 40;
69 
75  conddb_column(INSERTION_TIME, boost::posix_time::ptime);
76 
77  class Table : public IPayloadTable {
78  public:
79  explicit Table(coral::ISchema& schema);
80  ~Table() override {}
81  bool exists() override;
82  void create() override;
83  bool select(const cond::Hash& payloadHash);
84  bool select(const cond::Hash& payloadHash,
85  std::string& objectType,
86  cond::Binary& payloadData,
87  cond::Binary& streamerInfoData) override;
88  bool getType(const cond::Hash& payloadHash, std::string& objectType) override;
89  bool insert(const cond::Hash& payloadHash,
90  const std::string& objectType,
91  const cond::Binary& payloadData,
92  const cond::Binary& streamerInfoData,
93  const boost::posix_time::ptime& insertionTime);
94  cond::Hash insertIfNew(const std::string& objectType,
95  const cond::Binary& payloadData,
96  const cond::Binary& streamerInfoData,
97  const boost::posix_time::ptime& insertionTime) override;
98 
99  private:
100  coral::ISchema& m_schema;
101  };
102  }
103 
108  conddb_column(INSERTION_TIME, boost::posix_time::ptime);
109 
110  struct SINCE_GROUP {
112  static constexpr size_t size = 0;
113  static std::string tableName() { return SINCE::tableName(); }
114  static std::string fullyQualifiedName() { return "MIN(" + SINCE::fullyQualifiedName() + ")"; }
115  static std::string group(unsigned long long groupSize) {
116  std::string sgroupSize = std::to_string(groupSize);
117  return "CAST(" + SINCE::fullyQualifiedName() + "/" + sgroupSize + " AS INT )*" + sgroupSize;
118  }
119  };
120 
121  struct SEQUENCE_SIZE {
122  typedef unsigned int type;
123  static constexpr size_t size = 0;
124  static std::string tableName() { return SINCE::tableName(); }
125  static std::string fullyQualifiedName() { return "COUNT(*)"; }
126  };
127 
128  struct MIN_SINCE {
130  static constexpr size_t size = 0;
131  static std::string tableName() { return SINCE::tableName(); }
132  static std::string fullyQualifiedName() { return "MIN(" + SINCE::fullyQualifiedName() + ")"; }
133  };
134 
135  struct MAX_SINCE {
137  static constexpr size_t size = 0;
138  static std::string tableName() { return SINCE::tableName(); }
139  static std::string fullyQualifiedName() { return "MAX(" + SINCE::fullyQualifiedName() + ")"; }
140  };
141 
142  class Table : public IIOVTable {
143  public:
144  explicit Table(coral::ISchema& schema);
145  ~Table() override {}
146  bool exists() override;
147  void create() override;
148  size_t getGroups(const std::string& tag,
149  const boost::posix_time::ptime& snapshotTime,
150  unsigned long long groupSize,
151  std::vector<cond::Time_t>& groups) override;
152  size_t select(const std::string& tag,
153  cond::Time_t lowerGroup,
154  cond::Time_t upperGroup,
155  const boost::posix_time::ptime& snapshotTime,
156  std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override;
157  bool getLastIov(const std::string& tag,
158  const boost::posix_time::ptime& snapshotTime,
160  cond::Hash& hash) override;
161  bool getSize(const std::string& tag, const boost::posix_time::ptime& snapshotTime, size_t& size) override;
162  bool getRange(const std::string& tag,
165  const boost::posix_time::ptime& snapshotTime,
166  std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override;
167  void insertOne(const std::string& tag,
169  cond::Hash payloadHash,
170  const boost::posix_time::ptime& insertTime) override;
171  void insertMany(
172  const std::string& tag,
173  const std::vector<std::tuple<cond::Time_t, cond::Hash, boost::posix_time::ptime> >& iovs) override;
174  void eraseOne(const std::string& tag, cond::Time_t since, cond::Hash payloadId) override;
175  void eraseMany(const std::string& tag, const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) override;
176  void erase(const std::string& tag) override;
177 
178  private:
179  coral::ISchema& m_schema;
180  };
181  }
182 
183  conddb_table(TAG_LOG) {
185  conddb_column(EVENT_TIME, boost::posix_time::ptime);
191 
192  class Table : public ITagLogTable {
193  public:
194  explicit Table(coral::ISchema& schema);
195  ~Table() override {}
196  bool exists() override;
197  void create() override;
198  void insert(const std::string& tag,
199  const boost::posix_time::ptime& eventTime,
200  const std::string& userName,
201  const std::string& hostName,
202  const std::string& command,
203  const std::string& action,
204  const std::string& userText) override;
205 
206  private:
207  coral::ISchema& m_schema;
208  };
209  }
210 
211  class IOVSchema : public IIOVSchema {
212  public:
213  explicit IOVSchema(coral::ISchema& schema);
214  ~IOVSchema() override {}
215  bool exists() override;
216  bool create() override;
217  ITagTable& tagTable() override;
218  IIOVTable& iovTable() override;
219  ITagLogTable& tagLogTable() override;
220  IPayloadTable& payloadTable() override;
221 
222  private:
227  };
228 
229  } // namespace persistency
230 } // namespace cond
231 #endif
cond::persistency::IOVSchema::exists
bool exists() override
Definition: IOVSchema.cc:418
cond::persistency::IOVSchema::m_tagTable
TAG::Table m_tagTable
Definition: IOVSchema.h:223
cond::persistency::PAYLOAD::DATA
Definition: IOVSchema.h:72
cond::persistency::IOV::MAX_SINCE
Definition: IOVSchema.h:135
cond::persistency::TAG_LOG::USER_NAME
Definition: IOVSchema.h:186
cond::TimeType
TimeType
Definition: Time.h:19
cond::persistency::IOV::SINCE
Definition: IOVSchema.h:106
cond::persistency::TAG_LOG::Table::~Table
~Table() override
Definition: IOVSchema.h:195
cond::Hash
std::string Hash
Definition: Types.h:43
cond::Binary
Definition: Binary.h:15
GlobalTag_cfi.snapshotTime
snapshotTime
Definition: GlobalTag_cfi.py:19
cond::persistency::IOV::SINCE_GROUP
Definition: IOVSchema.h:110
cond::hash
Definition: Time.h:19
cond::persistency::IOV::MIN_SINCE::tableName
static std::string tableName()
Definition: IOVSchema.h:131
edmLumisInFiles.description
description
Definition: edmLumisInFiles.py:11
singleTopDQM_cfi.select
select
Definition: singleTopDQM_cfi.py:50
cond::persistency::IOV::MIN_SINCE::type
cond::Time_t type
Definition: IOVSchema.h:129
cond::persistency::IOVSchema::~IOVSchema
~IOVSchema() override
Definition: IOVSchema.h:214
cond::persistency::PAYLOAD::PAYLOAD_HASH_SIZE
static constexpr unsigned int PAYLOAD_HASH_SIZE
Definition: IOVSchema.h:68
cond::persistency::IOVSchema::m_payloadTable
PAYLOAD::Table m_payloadTable
Definition: IOVSchema.h:226
cond::persistency::TAG::Table::~Table
~Table() override
Definition: IOVSchema.h:27
cond::persistency::IOV::MAX_SINCE::type
cond::Time_t type
Definition: IOVSchema.h:136
cond::persistency::TAG_LOG::TAG_NAME
Definition: IOVSchema.h:184
cond::persistency::IOV::MAX_SINCE::tableName
static std::string tableName()
Definition: IOVSchema.h:138
cond::persistency::IIOVSchema
Definition: IDbSchema.h:155
cond::persistency::TAG::Table
Definition: IOVSchema.h:24
cond::persistency::TAG_LOG::EVENT_TIME
Definition: IOVSchema.h:185
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:225
cond::persistency::TAG::MODIFICATION_TIME
Definition: IOVSchema.h:22
cond::persistency::IOVSchema::tagLogTable
ITagLogTable & tagLogTable() override
Definition: IOVSchema.cc:444
mps_check.command
list command
Definition: mps_check.py:25
cond::persistency::IOV::SEQUENCE_SIZE::type
unsigned int type
Definition: IOVSchema.h:122
EcalCondDBWriter_cfi.userName
userName
Definition: EcalCondDBWriter_cfi.py:61
end
#define end
Definition: vmac.h:39
conddb_column
#define conddb_column(...)
Definition: DbCore.h:75
cond::persistency::IOV::Table::~Table
~Table() override
Definition: IOVSchema.h:145
cond::persistency::PAYLOAD::STREAMER_INFO
Definition: IOVSchema.h:73
cond::persistency::TAG::END_OF_VALIDITY
Definition: IOVSchema.h:18
cond::persistency::TAG::LAST_VALIDATED_TIME
Definition: IOVSchema.h:20
cond::persistency::IOV::INSERTION_TIME
Definition: IOVSchema.h:108
cond::persistency::IOV::PAYLOAD_HASH
Definition: IOVSchema.h:107
cond::persistency::IPayloadTable
Definition: IDbSchema.h:53
cond::persistency::IOVSchema::create
bool create() override
Definition: IOVSchema.cc:428
cond::SynchronizationType
SynchronizationType
Definition: Types.h:27
cond::persistency::TAG::Table::setValidationMode
void setValidationMode() override
Definition: IOVSchema.h:60
cond::persistency::PAYLOAD::Table::m_schema
coral::ISchema & m_schema
Definition: IOVSchema.h:100
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
cond::persistency::IOVSchema::payloadTable
IPayloadTable & payloadTable() override
Definition: IOVSchema.cc:446
cond::persistency::IOV::SEQUENCE_SIZE::fullyQualifiedName
static std::string fullyQualifiedName()
Definition: IOVSchema.h:125
HLT_2018_cff.tableName
tableName
Definition: HLT_2018_cff.py:10
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:115
cond::persistency::TAG_LOG::USER_TEXT
Definition: IOVSchema.h:190
cond::persistency::TAG_LOG::Table::m_schema
coral::ISchema & m_schema
Definition: IOVSchema.h:207
cond::persistency::IOV::Table::m_schema
coral::ISchema & m_schema
Definition: IOVSchema.h:179
cond::persistency::PAYLOAD::VERSION
Definition: IOVSchema.h:74
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::PAYLOAD::HASH
Definition: IOVSchema.h:70
cond
Definition: plugin.cc:23
cond::persistency::IOV::SEQUENCE_SIZE
Definition: IOVSchema.h:121
EcalCondDBWriter_cfi.hostName
hostName
Definition: EcalCondDBWriter_cfi.py:59
cond::persistency::IOV::MAX_SINCE::fullyQualifiedName
static std::string fullyQualifiedName()
Definition: IOVSchema.h:139
cond::persistency::TAG::Table::m_schema
coral::ISchema & m_schema
Definition: IOVSchema.h:63
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:114
cond::persistency::TAG_LOG::COMMAND
Definition: IOVSchema.h:188
writedatasetfile.action
action
Definition: writedatasetfile.py:8
cond::persistency::IOV::TAG_NAME
Definition: IOVSchema.h:105
cond::persistency::PAYLOAD::Table
Definition: IOVSchema.h:77
cond::persistency::PAYLOAD::Table::~Table
~Table() override
Definition: IOVSchema.h:80
cond::persistency::ITagTable
Definition: IDbSchema.h:15
cond::persistency::PAYLOAD::INSERTION_TIME
Definition: IOVSchema.h:75
conddb_table
#define conddb_table(NAME)
Definition: DbCore.h:48
cond::persistency::IOV::SEQUENCE_SIZE::tableName
static std::string tableName()
Definition: IOVSchema.h:124
cond::persistency::TAG_LOG::ACTION
Definition: IOVSchema.h:189
cond::persistency::TAG::OBJECT_TYPE
Definition: IOVSchema.h:16
cond::persistency::IOVSchema::IOVSchema
IOVSchema(coral::ISchema &schema)
Definition: IOVSchema.cc:415
cond::persistency::ITagLogTable
Definition: IDbSchema.h:141
cond::persistency::TAG_LOG::Table
Definition: IOVSchema.h:192
cond::persistency::IOVSchema::iovTable
IIOVTable & iovTable() override
Definition: IOVSchema.cc:442
cond::persistency::IIOVTable
Definition: IDbSchema.h:69
cond::persistency::IOV::SINCE_GROUP::tableName
static std::string tableName()
Definition: IOVSchema.h:113
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:111
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:132
cond::persistency::IOVSchema::tagTable
ITagTable & tagTable() override
Definition: IOVSchema.cc:440
cond::persistency::IOV::Table
Definition: IOVSchema.h:142
cond::persistency::TAG::INSERTION_TIME
Definition: IOVSchema.h:21
cond::persistency::IOVSchema::m_iovTable
IOV::Table m_iovTable
Definition: IOVSchema.h:224
cond::persistency::TAG::SYNCHRONIZATION
Definition: IOVSchema.h:17
cond::persistency::TAG::TIME_TYPE
Definition: IOVSchema.h:15
cond::persistency::PAYLOAD::OBJECT_TYPE
Definition: IOVSchema.h:71
begin
#define begin
Definition: vmac.h:32
cond::persistency::TAG::NAME
Definition: IOVSchema.h:14
cond::persistency::TAG_LOG::HOST_NAME
Definition: IOVSchema.h:187
cond::persistency::IOV::MIN_SINCE
Definition: IOVSchema.h:128
update
#define update(a, b)
Definition: TrackClassifier.cc:10
cond::persistency::IOVSchema
Definition: IOVSchema.h:211
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443