CMS 3D CMS Logo

IOVEditor.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_IOVEditor_h
2 #define CondCore_CondDB_IOVEditor_h
3 //
4 // Package: CondDB
5 // Class : IOVEditor
6 //
10 //
11 // Author: Giacomo Govi
12 // Created: Apr 2013
13 //
14 
17 //
18 #include <boost/date_time/posix_time/posix_time.hpp>
19 
20 namespace cond {
21 
22  namespace persistency {
23 
24  class SessionImpl;
25  class IOVEditorData;
26 
27  // value semantics...
28  class IOVEditor {
29  public:
30  IOVEditor();
31  // ctor
32  explicit IOVEditor(const std::shared_ptr<SessionImpl>& session);
33 
34  // ctor used after new tag creation. the specified params are assumed and passed directly to the object.
35  IOVEditor(const std::shared_ptr<SessionImpl>& session,
36  const std::string& tag,
38  const std::string& payloadType,
40  const boost::posix_time::ptime& creationTime = boost::posix_time::microsec_clock::universal_time());
41 
42  //
43  IOVEditor(const IOVEditor& rhs);
44 
45  //
46  IOVEditor& operator=(const IOVEditor& rhs);
47 
48  // loads to tag to edit
49  void load(const std::string& tag);
50 
51  // read only getters. they could be changed to return references...
52  std::string tag() const;
53  cond::TimeType timeType() const;
54  std::string payloadType() const;
55 
56  // getters/setters for the updatable parameters
59 
61  void setEndOfValidity(cond::Time_t validity);
62 
63  std::string description() const;
65 
68 
69  // flag (hack) for the validation
70  void setValidationMode();
71 
72  // register a new insertion.
73  // if checkType==true, the payload corresponding to the specified id is verified to be the same type as the iov payloadObjectType
74  void insert(cond::Time_t since, const cond::Hash& payloadHash, bool checkType = false);
76  const cond::Hash& payloadHash,
77  const boost::posix_time::ptime& insertionTime,
78  bool checkType = false);
79 
80  // register a new deletion.
81  void erase(cond::Time_t since, const cond::Hash& payloadHash);
82 
83  // execute the update/intert queries and reset the buffer
84  bool flush();
85  bool flush(const boost::posix_time::ptime& operationTime);
86  bool flush(const std::string& logText);
87  bool flush(const std::string& logText, bool forceInsertion);
88 
89  private:
90  bool flush(const std::string& logText, const boost::posix_time::ptime& operationTime, bool forceInsertion);
91  void checkTransaction(const std::string& ctx);
92 
93  private:
94  std::shared_ptr<IOVEditorData> m_data;
95  std::shared_ptr<SessionImpl> m_session;
96  };
97 
98  } // namespace persistency
99 } // namespace cond
100 
101 #endif
cond::persistency::IOVEditor::insert
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
Definition: IOVEditor.cc:139
cond::TimeType
TimeType
Definition: Time.h:19
cond::persistency::IOVEditor::setLastValidatedTime
void setLastValidatedTime(cond::Time_t time)
Definition: IOVEditor.cc:126
cond::Hash
std::string Hash
Definition: Types.h:43
cond::persistency::IOVEditor::tag
std::string tag() const
Definition: IOVEditor.cc:84
cond::persistency::IOVEditor
Definition: IOVEditor.h:28
cond::persistency::IOVEditor::setValidationMode
void setValidationMode()
Definition: IOVEditor.cc:134
cond::SynchronizationType
SynchronizationType
Definition: Types.h:27
cond::persistency::IOVEditor::m_session
std::shared_ptr< SessionImpl > m_session
Definition: IOVEditor.h:95
cond::persistency::IOVEditor::m_data
std::shared_ptr< IOVEditorData > m_data
Definition: IOVEditor.h:94
writeEcalDQMStatus.since
since
Definition: writeEcalDQMStatus.py:53
cond::persistency::IOVEditor::setDescription
void setDescription(const std::string &description)
Definition: IOVEditor.cc:114
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
Time.h
createPayload.checkType
checkType
Definition: createPayload.py:383
cond::persistency::IOVEditor::timeType
cond::TimeType timeType() const
Definition: IOVEditor.cc:86
cond::persistency::IOVEditor::description
std::string description() const
Definition: IOVEditor.cc:112
cond::persistency::IOVEditor::synchronizationType
cond::SynchronizationType synchronizationType() const
Definition: IOVEditor.cc:90
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
cond::persistency::IOVEditor::IOVEditor
IOVEditor()
Definition: IOVEditor.cc:40
cond::persistency::IOVEditor::lastValidatedTime
cond::Time_t lastValidatedTime() const
Definition: IOVEditor.cc:122
BeamSpotPI::creationTime
Definition: BeamSpotPayloadInspectorHelper.h:43
cond::persistency::IOVEditor::payloadType
std::string payloadType() const
Definition: IOVEditor.cc:88
cond::persistency::IOVEditor::setSynchronizationType
void setSynchronizationType(cond::SynchronizationType synchronizationType)
Definition: IOVEditor.cc:94
cond::persistency::IOVEditor::checkTransaction
void checkTransaction(const std::string &ctx)
Definition: IOVEditor.cc:303
cond::persistency::IOVEditor::setEndOfValidity
void setEndOfValidity(cond::Time_t validity)
Definition: IOVEditor.cc:104
cond::persistency::IOVEditor::operator=
IOVEditor & operator=(const IOVEditor &rhs)
Definition: IOVEditor.cc:62
cond::persistency::IOVEditor::erase
void erase(cond::Time_t since, const cond::Hash &payloadHash)
Definition: IOVEditor.cc:154
Types.h
ntuplemaker.time
time
Definition: ntuplemaker.py:310
cond::persistency::IOVEditor::flush
bool flush()
Definition: IOVEditor.cc:295
cond::persistency::IOVEditor::endOfValidity
cond::Time_t endOfValidity() const
Definition: IOVEditor.cc:102
cond::persistency::IOVEditor::load
void load(const std::string &tag)
Definition: IOVEditor.cc:68