48 m_closeIOV=iConfig.getUntrackedParameter<
bool>(
"closeIOV",m_closeIOV);
50 m_timetypestr=iConfig.getUntrackedParameter<
std::string >(
"timetype",
"runnumber");
56 connection.configure();
58 m_session = connection.createSession( connectionString,
true );
60 typedef std::vector< edm::ParameterSet >
Parameters;
61 Parameters
toPut=iConfig.getParameter<Parameters>(
"toPut");
62 for(Parameters::iterator itToPut = toPut.begin(); itToPut != toPut.end(); ++itToPut)
63 fillRecord( *itToPut);
94 return this->lookUpRecord(recordName).m_tag;
99 Record& myrecord=this->lookUpRecord(recordName);
106 std::lock_guard<std::recursive_mutex>
lock(m_mutex);
108 scope.
start(
false );
110 if( !m_session.existsDatabase() ) m_session.createDatabase();
123 m_session.transaction().commit();
146 for(
auto& time : m_currentTimes) {
153 for(
auto& time : m_currentTimes) {
160 m_session.transaction().rollback();
165 std::lock_guard<std::recursive_mutex>
lock(m_mutex);
166 if (!m_dbstarted) initDB();
192 std::lock_guard<std::recursive_mutex>
lock(m_mutex);
195 Record& myrecord=this->lookUpRecord(recordName);
196 if(!myrecord.m_isNewTag) {
197 cond::throwException( myrecord.m_tag +
" is not a new tag",
"PoolDBOutputService::createNewIOV");
205 editor.
insert( firstSinceTime, firstPayloadId );
208 myrecord.m_isNewTag=
false;
211 "PoolDBOutputService::createNewIOV");
222 std::lock_guard<std::recursive_mutex>
lock(m_mutex);
224 Record& myrecord=this->lookUpRecord(recordName);
225 if(!myrecord.m_isNewTag) {
226 cond::throwException( myrecord.m_tag +
" is not a new tag",
"PoolDBOutputService::createNewIOV");
235 editor.
insert( firstSinceTime, firstPayloadId );
238 myrecord.m_isNewTag=
false;
241 "PoolDBOutputService::createNewIOV");
251 std::lock_guard<std::recursive_mutex>
lock(m_mutex);
253 Record& myrecord=this->lookUpRecord(recordName);
254 if( myrecord.m_isNewTag ) {
256 "PoolDBOutputService::appendSinceTime");
262 editor.
insert( time, payloadId );
268 "PoolDBOutputService::appendSinceTime");
275 std::lock_guard<std::recursive_mutex>
lock(m_mutex);
276 if (!m_dbstarted) this->initDB();
278 std::map<std::string,Record>::iterator it=m_callbacks.find(recordName);
279 if(it==m_callbacks.end()) {
280 cond::throwException(
"The record \""+recordName +
"\" has not been registered.",
"PoolDBOutputService::lookUpRecord");
282 if( !m_session.existsIov( it->second.m_tag) ){
283 it->second.m_isNewTag=
true;
285 it->second.m_isNewTag=
false;
293 std::map<std::string,cond::UserLogInfo>::iterator it=m_logheaders.find(recordName);
294 if(it==m_logheaders.end())
throw cond::Exception(
"Log db was not set for record " + recordName +
" from PoolDBOutputService::lookUpUserLogInfo");
301 std::lock_guard<std::recursive_mutex>
lock(m_mutex);
303 Record & myrecord = lookUpRecord(recordName);
308 "PoolDBOutputService::closeIOV");
312 editor.
flush(
"Tag closed.");
329 std::lock_guard<std::recursive_mutex>
lock(m_mutex);
static thread_local int s_streamIndex
const TimeTypeSpecs timeTypeSpecs[]
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
boost::uint64_t value() const
Base exception class for the object to relational access.
void closeIOV(Time_t lastTill, const std::string &recordName, bool withlogging=false)
void preEventProcessing(edm::StreamContext const &)
void fillRecord(edm::ParameterSet &pset)
std::map< std::string, cond::UserLogInfo > m_logheaders
cond::persistency::Session session() const
LuminosityBlockID const & luminosityBlockID() const
std::pair< Time_t, Time_t > ValidityInterval
void initDB(bool dummy=false)
void setDescription(const std::string &description)
void preGlobalBeginLumi(edm::GlobalContext const &)
void throwException(const std::string &message, const std::string &methodName)
void setParameters(const edm::ParameterSet &connectionPset)
std::string tag(const std::string &recordName)
unsigned int maxNumberOfStreams() const
cond::ValidityInterval lastInterval
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
unsigned long long Time_t
vector< ParameterSet > Parameters
TimeType timeTypeFromName(const std::string &name)
bool isNewTagRequest(const std::string &recordName)
Record & lookUpRecord(const std::string &recordName)
cond::Time_t beginOfTime() const
void start(bool readOnly=true)
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void setLogHeaderForRecord(const std::string &recordName, const std::string &provenance, const std::string &usertext)
StreamID const & streamID() const
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
unsigned int value() const
virtual ~PoolDBOutputService()
void tagInfo(const std::string &recordName, cond::TagInfo_t &result)
std::string lastPayloadToken
cond::Time_t endOfTime() const
void preGlobalBeginRun(edm::GlobalContext const &)
cond::Time_t currentTime() const
void postModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
void setEndOfValidity(cond::Time_t validity)
cond::TimeType m_timetype
std::map< std::string, Record > m_callbacks
void preModuleEvent(edm::StreamContext const &, edm::ModuleCallingContext const &)
std::string payloadType() const
std::string m_timetypestr
cond::UserLogInfo & lookUpUserLogInfo(const std::string &recordName)
TimeValue_t value() const
PoolDBOutputService(const edm::ParameterSet &iConfig, edm::ActivityRegistry &iAR)
Timestamp const & timestamp() const