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  //
49  ~IOVEditor();
50 
51  // loads to tag to edit
52  void load(const std::string& tag);
53 
54  // read only getters. they could be changed to return references...
55  std::string tag() const;
56  cond::TimeType timeType() const;
57  std::string payloadType() const;
58 
59  // getters/setters for the updatable parameters
62 
64  void setEndOfValidity(cond::Time_t validity);
65 
66  std::string description() const;
68 
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  bool isLocked() const;
90  void lock();
91  void unlock();
92 
93  private:
94  bool flush(const std::string& logText, const boost::posix_time::ptime& operationTime, bool forceInsertion);
95  void checkTransaction(const std::string& ctx);
96 
97  private:
98  std::shared_ptr<IOVEditorData> m_data;
99  std::shared_ptr<SessionImpl> m_session;
100  };
101 
102  } // namespace persistency
103 } // namespace cond
104 
105 #endif
cond::persistency::IOVEditor::~IOVEditor
~IOVEditor()
Definition: IOVEditor.cc:63
cond::persistency::IOVEditor::insert
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
Definition: IOVEditor.cc:159
cond::TimeType
TimeType
Definition: Time.h:19
cond::persistency::IOVEditor::setLastValidatedTime
void setLastValidatedTime(cond::Time_t time)
Definition: IOVEditor.cc:151
cond::Hash
std::string Hash
Definition: Types.h:43
cond::persistency::IOVEditor::tag
std::string tag() const
Definition: IOVEditor.cc:109
cond::persistency::IOVEditor::isLocked
bool isLocked() const
Definition: IOVEditor.cc:323
cond::persistency::IOVEditor
Definition: IOVEditor.h:28
protons_cff.time
time
Definition: protons_cff.py:35
cond::SynchronizationType
SynchronizationType
Definition: Types.h:27
cond::persistency::IOVEditor::m_session
std::shared_ptr< SessionImpl > m_session
Definition: IOVEditor.h:99
cond::persistency::IOVEditor::m_data
std::shared_ptr< IOVEditorData > m_data
Definition: IOVEditor.h:98
writeEcalDQMStatus.since
since
Definition: writeEcalDQMStatus.py:53
cond::persistency::IOVEditor::setDescription
void setDescription(const std::string &description)
Definition: IOVEditor.cc:139
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:111
cond::persistency::IOVEditor::description
std::string description() const
Definition: IOVEditor.cc:137
cond::persistency::IOVEditor::synchronizationType
cond::SynchronizationType synchronizationType() const
Definition: IOVEditor.cc:115
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
cond::persistency::IOVEditor::IOVEditor
IOVEditor()
Definition: IOVEditor.cc:41
cond::persistency::IOVEditor::lastValidatedTime
cond::Time_t lastValidatedTime() const
Definition: IOVEditor.cc:147
BeamSpotPI::creationTime
Definition: BeamSpotPayloadInspectorHelper.h:44
cond::persistency::IOVEditor::payloadType
std::string payloadType() const
Definition: IOVEditor.cc:113
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::IOVEditor::setSynchronizationType
void setSynchronizationType(cond::SynchronizationType synchronizationType)
Definition: IOVEditor.cc:119
cond::persistency::IOVEditor::checkTransaction
void checkTransaction(const std::string &ctx)
Definition: IOVEditor.cc:369
cond::persistency::IOVEditor::setEndOfValidity
void setEndOfValidity(cond::Time_t validity)
Definition: IOVEditor.cc:129
cond::persistency::IOVEditor::operator=
IOVEditor & operator=(const IOVEditor &rhs)
Definition: IOVEditor.cc:65
cond::persistency::IOVEditor::erase
void erase(cond::Time_t since, const cond::Hash &payloadHash)
Definition: IOVEditor.cc:174
Types.h
cond::persistency::IOVEditor::flush
bool flush()
Definition: IOVEditor.cc:315
cond::persistency::IOVEditor::lock
void lock()
Definition: IOVEditor.cc:325
cond::persistency::IOVEditor::endOfValidity
cond::Time_t endOfValidity() const
Definition: IOVEditor.cc:127
cond::persistency::IOVEditor::load
void load(const std::string &tag)
Definition: IOVEditor.cc:71
cond::persistency::IOVEditor::unlock
void unlock()
Definition: IOVEditor.cc:348