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 
31  IOVEditor();
32  // ctor
33  explicit IOVEditor( const std::shared_ptr<SessionImpl>& session );
34 
35  // ctor used after new tag creation. the specified params are assumed and passed directly to the object.
36  IOVEditor( const std::shared_ptr<SessionImpl>& session,
37  const std::string& tag,
39  const std::string& payloadType,
41  const boost::posix_time::ptime& creationTime = boost::posix_time::microsec_clock::universal_time() );
42 
43  //
44  IOVEditor( const IOVEditor& rhs );
45 
46  //
47  IOVEditor& operator=( const IOVEditor& rhs );
48 
49  // loads to tag to edit
50  void load( const std::string& tag );
51 
52  // read only getters. they could be changed to return references...
53  std::string tag() const;
54  cond::TimeType timeType() const;
55  std::string payloadType() const;
57 
58  // getters/setters for the updatable parameters
60  void setEndOfValidity( cond::Time_t validity );
61 
62  std::string description() const;
63  void setDescription( const std::string& description );
64 
67 
68  // flag (hack) for the validation
69  void setValidationMode();
70 
71  // register a new insertion.
72  // if checkType==true, the payload corresponding to the specified id is verified to be the same type as the iov payloadObjectType
73  void insert( cond::Time_t since, const cond::Hash& payloadHash, bool checkType=false );
74  void insert( cond::Time_t since, const cond::Hash& payloadHash, const boost::posix_time::ptime& insertionTime, bool checkType=false );
75 
76  // execute the update/intert queries and reset the buffer
77  bool flush();
78  bool flush( const boost::posix_time::ptime& operationTime );
79 
80  private:
81  void checkTransaction( const std::string& ctx );
82 
83  private:
84  std::shared_ptr<IOVEditorData> m_data;
85  std::shared_ptr<SessionImpl> m_session;
86 
87  };
88 
89  }
90 }
91 
92 #endif
93 
void checkTransaction(const std::string &ctx)
Definition: IOVEditor.cc:203
void load(const std::string &tag)
Definition: IOVEditor.cc:72
void setDescription(const std::string &description)
Definition: IOVEditor.cc:116
void setLastValidatedTime(cond::Time_t time)
Definition: IOVEditor.cc:127
std::shared_ptr< SessionImpl > m_session
Definition: IOVEditor.h:85
TimeType
Definition: Time.h:21
std::string description() const
Definition: IOVEditor.cc:112
unsigned long long Time_t
Definition: Time.h:16
std::string Hash
Definition: Types.h:47
IOVEditor & operator=(const IOVEditor &rhs)
Definition: IOVEditor.cc:66
cond::SynchronizationType synchronizationType() const
Definition: IOVEditor.cc:97
cond::Time_t endOfValidity() const
Definition: IOVEditor.cc:101
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
Definition: IOVEditor.cc:138
std::shared_ptr< IOVEditorData > m_data
Definition: IOVEditor.h:84
cond::TimeType timeType() const
Definition: IOVEditor.cc:89
cond::Time_t lastValidatedTime() const
Definition: IOVEditor.cc:123
SynchronizationType
Definition: Types.h:31
void setEndOfValidity(cond::Time_t validity)
Definition: IOVEditor.cc:105
std::string tag() const
Definition: IOVEditor.cc:84
std::string payloadType() const
Definition: IOVEditor.cc:93