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 
13  conddb_table( TAG ) {
14 
22  conddb_column( INSERTION_TIME, boost::posix_time::ptime );
23  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, cond::TimeType& timeType, std::string& objectType, cond::SynchronizationType& synchronizationType,
33  cond::Time_t& endOfValidity, std::string& description, cond::Time_t& lastValidatedTime ) override;
34  bool getMetadata( const std::string& name, std::string& description,
35  boost::posix_time::ptime& insertionTime, boost::posix_time::ptime& modificationTime ) override;
36  void insert( const std::string& name, cond::TimeType timeType, const std::string& objectType,
37  cond::SynchronizationType synchronizationType, cond::Time_t endOfValidity, const std::string& description,
38  cond::Time_t lastValidatedTime, const boost::posix_time::ptime& insertionTime ) override;
39  void update( const std::string& name, cond::SynchronizationType synchronizationType, cond::Time_t& endOfValidity, const std::string& description,
40  cond::Time_t lastValidatedTime, const boost::posix_time::ptime& updateTime ) override;
41  void updateValidity( const std::string& name, cond::Time_t lastValidatedTime, const boost::posix_time::ptime& updateTime ) override;
42  void setValidationMode() override{}
43  private:
44  coral::ISchema& m_schema;
45  };
46  }
47 
48  conddb_table ( PAYLOAD ) {
49 
50  static constexpr unsigned int PAYLOAD_HASH_SIZE = 40;
51 
52  conddb_column( HASH, std::string, PAYLOAD_HASH_SIZE );
57  conddb_column( INSERTION_TIME, boost::posix_time::ptime );
58 
59  class Table : public IPayloadTable {
60  public:
61  explicit Table( coral::ISchema& schema );
62  ~Table() override{}
63  bool exists() override;
64  void create() override;
65  bool select( const cond::Hash& payloadHash);
66  bool select( const cond::Hash& payloadHash, std::string& objectType,
67  cond::Binary& payloadData, cond::Binary& streamerInfoData) override;
68  bool getType( const cond::Hash& payloadHash, std::string& objectType ) override;
69  bool insert( const cond::Hash& payloadHash, const std::string& objectType,
70  const cond::Binary& payloadData, const cond::Binary& streamerInfoData,
71  const boost::posix_time::ptime& insertionTime);
72  cond::Hash insertIfNew( const std::string& objectType, const cond::Binary& payloadData,
73  const cond::Binary& streamerInfoData, const boost::posix_time::ptime& insertionTime ) override;
74  private:
75  coral::ISchema& m_schema;
76  };
77  }
78 
79  conddb_table( IOV ) {
80 
84  conddb_column( INSERTION_TIME, boost::posix_time::ptime );
85 
86  struct SINCE_GROUP {
87  typedef cond::Time_t type;
88  static constexpr size_t size = 0;
89  static std::string tableName(){ return SINCE::tableName(); }
91  return "MIN("+SINCE::fullyQualifiedName()+")";
92  }
93  static std::string group( unsigned long long groupSize ){
94  std::string sgroupSize = std::to_string(groupSize);
95  return "CAST("+SINCE::fullyQualifiedName()+"/"+sgroupSize+" AS INT )*"+sgroupSize;
96  }
97  };
98 
99  struct SEQUENCE_SIZE {
100  typedef unsigned int type;
101  static constexpr size_t size = 0;
102  static std::string tableName(){ return SINCE::tableName(); }
104  return "COUNT(*)";
105  }
106  };
107 
108  struct MIN_SINCE {
109  typedef cond::Time_t type;
110  static constexpr size_t size = 0;
111  static std::string tableName(){ return SINCE::tableName(); }
113  return "MIN("+SINCE::fullyQualifiedName()+")";
114  }
115  };
116 
117  struct MAX_SINCE {
118  typedef cond::Time_t type;
119  static constexpr size_t size = 0;
120  static std::string tableName(){ return SINCE::tableName(); }
122  return "MAX("+SINCE::fullyQualifiedName()+")";
123  }
124  };
125 
126  class Table : public IIOVTable {
127  public:
128  explicit Table( coral::ISchema& schema );
129  ~Table() override{}
130  bool exists() override;
131  void create() override;
132  size_t getGroups( const std::string& tag, const boost::posix_time::ptime& snapshotTime, unsigned long long groupSize,
133  std::vector<cond::Time_t>& groups ) override;
134  size_t select( const std::string& tag, cond::Time_t lowerGroup, cond::Time_t upperGroup,
135  const boost::posix_time::ptime& snapshotTime,
136  std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs) override;
137  bool getLastIov( const std::string& tag, const boost::posix_time::ptime& snapshotTime, cond::Time_t& since, cond::Hash& hash ) override;
138  bool getSize( const std::string& tag, const boost::posix_time::ptime& snapshotTime, size_t& size ) override;
139  bool getRange( const std::string& tag, cond::Time_t begin, cond::Time_t end,
140  const boost::posix_time::ptime& snapshotTime, std::vector<std::tuple<cond::Time_t,cond::Hash> >& iovs ) override;
141  void insertOne( const std::string& tag, cond::Time_t since, cond::Hash payloadHash, const boost::posix_time::ptime& insertTime) override;
142  void insertMany( const std::string& tag, const std::vector<std::tuple<cond::Time_t,cond::Hash,boost::posix_time::ptime> >& iovs ) override;
143  void erase( const std::string& tag ) override;
144  private:
145  coral::ISchema& m_schema;
146  };
147  }
148 
149  conddb_table( TAG_LOG ) {
150 
152  conddb_column( EVENT_TIME, boost::posix_time::ptime );
158 
159  class Table : public ITagLogTable {
160  public:
161  explicit Table( coral::ISchema& schema );
162  ~Table() override{}
163  bool exists() override;
164  void create() override;
165  void insert( const std::string& tag, const boost::posix_time::ptime& eventTime, const std::string& userName, const std::string& hostName,
166  const std::string& command, const std::string& action, const std::string& userText ) override;
167  private:
168  coral::ISchema& m_schema;
169  };
170  }
171 
172  class IOVSchema : public IIOVSchema {
173  public:
174  explicit IOVSchema( coral::ISchema& schema );
175  ~IOVSchema() override{}
176  bool exists() override;
177  bool create() override;
178  ITagTable& tagTable() override;
179  IIOVTable& iovTable() override;
180  ITagLogTable& tagLogTable() override;
181  IPayloadTable& payloadTable() override;
182  private:
187  };
188 
189  }
190 }
191 #endif
size
Write out results.
static std::string tableName()
Definition: IOVSchema.h:120
def create(alignables, pedeDump, additionalData, outputFile, config)
void setValidationMode() override
Definition: IOVSchema.h:42
static std::string tableName()
Definition: IOVSchema.h:111
#define conddb_column(...)
Definition: DbCore.h:73
PAYLOAD::Table m_payloadTable
Definition: IOVSchema.h:186
coral::ISchema & m_schema
Definition: IOVSchema.h:44
TimeType
Definition: Time.h:21
static std::string group(unsigned long long groupSize)
Definition: IOVSchema.h:93
coral::ISchema & m_schema
Definition: IOVSchema.h:145
unsigned long long Time_t
Definition: Time.h:16
std::string Hash
Definition: Types.h:45
#define end
Definition: vmac.h:39
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
static std::string fullyQualifiedName()
Definition: IOVSchema.h:121
static std::string tableName()
Definition: IOVSchema.h:89
static std::string tableName()
Definition: IOVSchema.h:102
TAG_LOG::Table m_tagLogTable
Definition: IOVSchema.h:185
static std::string fullyQualifiedName()
Definition: IOVSchema.h:90
static unsigned int PAYLOAD_HASH_SIZE
Definition: IOVSchema.h:50
static std::string fullyQualifiedName()
Definition: IOVSchema.h:103
list command
Definition: mps_check.py:25
Definition: plugin.cc:24
#define begin
Definition: vmac.h:32
#define update(a, b)
SynchronizationType
Definition: Types.h:29
#define conddb_table(NAME)
Definition: DbCore.h:48
#define constexpr
static std::string fullyQualifiedName()
Definition: IOVSchema.h:112