CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
58  void setSynchronizationType(cond::SynchronizationType synchronizationType);
59 
61  void setEndOfValidity(cond::Time_t validity);
62 
63  std::string description() const;
64  void setDescription(const std::string& description);
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);
75  void insert(cond::Time_t since,
76  const cond::Hash& payloadHash,
77  const boost::posix_time::ptime& insertionTime,
78  bool checkType = false);
79 
80  // execute the update/intert queries and reset the buffer
81  bool flush();
82  bool flush(const boost::posix_time::ptime& operationTime);
83  bool flush(const std::string& logText);
84  bool flush(const std::string& logText, bool forceInsertion);
85 
86  private:
87  bool flush(const std::string& logText, const boost::posix_time::ptime& operationTime, bool forceInsertion);
88  void checkTransaction(const std::string& ctx);
89 
90  private:
91  std::shared_ptr<IOVEditorData> m_data;
92  std::shared_ptr<SessionImpl> m_session;
93  };
94 
95  } // namespace persistency
96 } // namespace cond
97 
98 #endif
void checkTransaction(const std::string &ctx)
Definition: IOVEditor.cc:275
void load(const std::string &tag)
Definition: IOVEditor.cc:64
void setDescription(const std::string &description)
Definition: IOVEditor.cc:111
void setLastValidatedTime(cond::Time_t time)
Definition: IOVEditor.cc:123
std::shared_ptr< SessionImpl > m_session
Definition: IOVEditor.h:92
TimeType
Definition: Time.h:19
std::string description() const
Definition: IOVEditor.cc:109
unsigned long long Time_t
Definition: Time.h:14
std::string Hash
Definition: Types.h:43
IOVEditor & operator=(const IOVEditor &rhs)
Definition: IOVEditor.cc:58
cond::SynchronizationType synchronizationType() const
Definition: IOVEditor.cc:87
cond::Time_t endOfValidity() const
Definition: IOVEditor.cc:99
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
Definition: IOVEditor.cc:136
std::shared_ptr< IOVEditorData > m_data
Definition: IOVEditor.h:91
cond::TimeType timeType() const
Definition: IOVEditor.cc:83
cond::Time_t lastValidatedTime() const
Definition: IOVEditor.cc:119
Definition: plugin.cc:23
SynchronizationType
Definition: Types.h:27
void setEndOfValidity(cond::Time_t validity)
Definition: IOVEditor.cc:101
std::string tag() const
Definition: IOVEditor.cc:81
void setSynchronizationType(cond::SynchronizationType synchronizationType)
Definition: IOVEditor.cc:91
std::string payloadType() const
Definition: IOVEditor.cc:85