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 
66  void setLastValidatedTime( cond::Time_t time );
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  bool flush( const std::string& logText );
80  bool flush( const std::string& logText, const boost::posix_time::ptime& operationTime );
81 
82  private:
83  void checkTransaction( const std::string& ctx );
84 
85  private:
86  std::shared_ptr<IOVEditorData> m_data;
87  std::shared_ptr<SessionImpl> m_session;
88 
89  };
90 
91  }
92 }
93 
94 #endif
95 
void checkTransaction(const std::string &ctx)
Definition: IOVEditor.cc:228
void load(const std::string &tag)
Definition: IOVEditor.cc:73
void setDescription(const std::string &description)
Definition: IOVEditor.cc:117
void setLastValidatedTime(cond::Time_t time)
Definition: IOVEditor.cc:128
std::shared_ptr< SessionImpl > m_session
Definition: IOVEditor.h:87
TimeType
Definition: Time.h:21
std::string description() const
Definition: IOVEditor.cc:113
unsigned long long Time_t
Definition: Time.h:16
std::string Hash
Definition: Types.h:45
IOVEditor & operator=(const IOVEditor &rhs)
Definition: IOVEditor.cc:67
cond::SynchronizationType synchronizationType() const
Definition: IOVEditor.cc:98
cond::Time_t endOfValidity() const
Definition: IOVEditor.cc:102
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
Definition: IOVEditor.cc:139
std::shared_ptr< IOVEditorData > m_data
Definition: IOVEditor.h:86
cond::TimeType timeType() const
Definition: IOVEditor.cc:90
cond::Time_t lastValidatedTime() const
Definition: IOVEditor.cc:124
SynchronizationType
Definition: Types.h:29
void setEndOfValidity(cond::Time_t validity)
Definition: IOVEditor.cc:106
session
Definition: models.py:201
std::string tag() const
Definition: IOVEditor.cc:85
std::string payloadType() const
Definition: IOVEditor.cc:94