File indexing completed on 2024-04-06 12:01:24
0001 #ifndef CondCore_CondDB_IOVEditor_h
0002 #define CondCore_CondDB_IOVEditor_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "CondCore/CondDB/interface/Time.h"
0016 #include "CondCore/CondDB/interface/Types.h"
0017
0018 #include <boost/date_time/posix_time/posix_time.hpp>
0019
0020 namespace cond {
0021
0022 namespace persistency {
0023
0024 class SessionImpl;
0025 class IOVEditorData;
0026
0027
0028 class IOVEditor {
0029 public:
0030 IOVEditor();
0031
0032 explicit IOVEditor(const std::shared_ptr<SessionImpl>& session);
0033
0034
0035 IOVEditor(const std::shared_ptr<SessionImpl>& session,
0036 const std::string& tag,
0037 cond::TimeType timeType,
0038 const std::string& payloadType,
0039 cond::SynchronizationType synchronizationType,
0040 const boost::posix_time::ptime& creationTime = boost::posix_time::microsec_clock::universal_time());
0041
0042
0043 IOVEditor(const IOVEditor& rhs);
0044
0045
0046 IOVEditor& operator=(const IOVEditor& rhs);
0047
0048
0049 ~IOVEditor();
0050
0051
0052 void load(const std::string& tag);
0053
0054
0055 std::string tag() const;
0056 cond::TimeType timeType() const;
0057 std::string payloadType() const;
0058
0059
0060 cond::SynchronizationType synchronizationType() const;
0061 void setSynchronizationType(cond::SynchronizationType synchronizationType);
0062
0063 cond::Time_t endOfValidity() const;
0064 void setEndOfValidity(cond::Time_t validity);
0065
0066 std::string description() const;
0067 void setDescription(const std::string& description);
0068
0069 cond::Time_t lastValidatedTime() const;
0070 void setLastValidatedTime(cond::Time_t time);
0071
0072
0073
0074 void insert(cond::Time_t since, const cond::Hash& payloadHash, bool checkType = false);
0075 void insert(cond::Time_t since,
0076 const cond::Hash& payloadHash,
0077 const boost::posix_time::ptime& insertionTime,
0078 bool checkType = false);
0079
0080
0081 void erase(cond::Time_t since, const cond::Hash& payloadHash);
0082
0083
0084 bool flush();
0085 bool flush(const boost::posix_time::ptime& operationTime);
0086 bool flush(const std::string& logText);
0087 bool flush(const std::string& logText, bool forceInsertion);
0088
0089 bool isLocked() const;
0090 void lock();
0091 void unlock();
0092
0093 private:
0094 bool flush(const std::string& logText, const boost::posix_time::ptime& operationTime, bool forceInsertion);
0095 void checkTransaction(const std::string& ctx);
0096
0097 private:
0098 std::shared_ptr<IOVEditorData> m_data;
0099 std::shared_ptr<SessionImpl> m_session;
0100 };
0101
0102 }
0103 }
0104
0105 #endif