1 #ifndef CondCore_PoolDBOutputService_h 2 #define CondCore_PoolDBOutputService_h 65 std::lock_guard<std::recursive_mutex>
lock(
m_mutex);
68 Hash thePayloadHash(
"");
71 auto& myrecord = this->
getRecord(recordName);
74 if (myrecord.m_onlyAppendUpdatePolicy && !newTag) {
80 if (
time <= lastSince) {
82 <<
", because is less or equal to last available since = " << lastSince;
86 return thePayloadHash;
103 return thePayloadHash;
106 template <
typename T>
108 if (iovAndPayloads.empty())
110 std::lock_guard<std::recursive_mutex>
lock(
m_mutex);
115 auto& myrecord = this->
getRecord(recordName);
126 if (myrecord.m_onlyAppendUpdatePolicy) {
134 for (
auto& iovEntry : iovAndPayloads) {
136 auto payload = iovEntry.second;
137 if (myrecord.m_onlyAppendUpdatePolicy && !newTag) {
138 if (
time <= lastSince) {
140 <<
", because is less or equal to last available since = " << lastSince;
162 template <
typename T>
164 std::lock_guard<std::recursive_mutex>
lock(
m_mutex);
169 auto& myrecord = this->
getRecord(recordName);
170 if (!myrecord.m_isNewTag) {
171 cond::throwException(myrecord.m_tag +
" is not a new tag",
"PoolDBOutputService::createNewIOV");
184 template <
typename T>
186 std::lock_guard<std::recursive_mutex>
lock(
m_mutex);
190 bool dbexists = this->
initDB(
true);
193 "PoolDBOutputService::appendSinceTime");
196 if (myrecord.m_isNewTag) {
198 "PoolDBOutputService::appendSinceTime");
291 bool initDB(
bool readOnly =
false);
const TimeTypeSpecs timeTypeSpecs[]
unsigned int m_refreshTime
void preEventProcessing(edm::StreamContext const &)
void fillRecord(edm::ParameterSet &pset, const std::string &gTimeTypeStr)
const Record & lookUpRecord(const std::string &recordName)
std::map< std::string, cond::UserLogInfo > m_logheaders
cond::Time_t beginOfTime() const
void doStartTransaction()
std::vector< cond::Time_t > m_currentTimes
IOVEditor createIov(const std::string &tag, cond::TimeType timeType, cond::SynchronizationType synchronizationType=cond::SYNCH_ANY)
void setDescription(const std::string &description)
bool initDB(bool readOnly=false)
void preGlobalBeginLumi(edm::GlobalContext const &)
Transaction & transaction()
void throwException(const std::string &message, const std::string &methodName)
static std::string to_string(const XMLCh *ch)
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
std::string tag(const std::string &recordName)
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
void closeIOV(Time_t lastTill, const std::string &recordName)
unsigned long long Time_t
bool isNewTagRequest(const std::string &recordName)
cond::Time_t currentTime() const
cond::persistency::Logger & logger()
cond::persistency::ConnectionPool m_connection
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
cond::persistency::Session m_session
cond::TimeType m_timetype
cond::Time_t endOfTime() const
void setLogHeaderForRecord(const std::string &recordName, const std::string &provenance, const std::string &usertext)
std::map< std::string, Record > m_records
cond::persistency::Logger m_logger
IOVEditor editIov(const std::string &tag)
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
virtual ~PoolDBOutputService()
Record & getRecord(const std::string &recordName)
unsigned int m_writeTransactionDelay
void preGlobalBeginRun(edm::GlobalContext const &)
bool appendSinceTime(const std::string &payloadId, cond::Time_t sinceTime, const std::string &recordName)
bool m_onlyAppendUpdatePolicy
void createNewIOV(const std::string &firstPayloadId, cond::Time_t firstSinceTime, const std::string &recordName)
bool getTagInfo(const std::string &recordName, cond::TagInfo_t &result)
cond::Hash storePayload(const T &payload, const boost::posix_time::ptime &creationTime=boost::posix_time::microsec_clock::universal_time())
static const std::string kSharedResource
void writeMany(const std::map< Time_t, std::shared_ptr< T > > &iovAndPayloads, const std::string &recordName)
std::recursive_mutex m_mutex
cond::persistency::Session newReadOnlySession(const std::string &connectionString, const std::string &transactionId)
void postModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
cond::TimeType m_timetype
void preModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
EchoedLogStream< edm::LogInfo > logInfo()
std::string timetypestr() const
bool tagInfo(const std::string &recordName, cond::TagInfo_t &result)
void eraseSinceTime(const std::string &payloadId, cond::Time_t sinceTime, const std::string &recordName)
const Time_t MAX_VAL(std::numeric_limits< Time_t >::max())
cond::UserLogInfo & lookUpUserLogInfo(const std::string &recordName)
PoolDBOutputService(const edm::ParameterSet &iConfig, edm::ActivityRegistry &iAR)
cond::persistency::Session session() const
void doCommitTransaction()