#include <PayloadProxy.h>
Classes | |
struct | ObjId |
struct | Stats |
Public Types | |
typedef std::vector< ObjId > | ObjIds |
Public Member Functions | |
BasePayloadProxy (cond::DbSession &session, bool errorPolicy) | |
BasePayloadProxy (cond::DbSession &session, const std::string &token, bool errorPolicy) | |
virtual void | invalidateCache ()=0 |
IOVProxy const & | iov () const |
bool | isValid () const |
cond::ValidityInterval | loadFor (cond::Time_t time) |
cond::ValidityInterval | loadFor (size_t n) |
void | loadIov (const std::string iovToken) |
virtual void | loadMore (CondGetter const &) |
void | loadTag (const std::string tag) |
void | make () |
bool | refresh () |
cond::ValidityInterval | setIntervalFor (cond::Time_t time) |
TimeType | timetype () const |
std::string const & | token () const |
virtual | ~BasePayloadProxy () |
Public Attributes | |
Stats | stats |
Static Public Attributes | |
static Stats | gstats = {0,0,0,0,0} |
Protected Attributes | |
bool | m_doThrow |
IOVElementProxy | m_element |
IOVProxy | m_iov |
DbSession | m_session |
std::string | m_token |
Private Member Functions | |
virtual bool | load (cond::DbSession &session, std::string const &token)=0 |
Definition at line 23 of file PayloadProxy.h.
typedef std::vector<ObjId> cond::BasePayloadProxy::ObjIds |
Definition at line 31 of file PayloadProxy.h.
cond::BasePayloadProxy::BasePayloadProxy | ( | cond::DbSession & | session, |
bool | errorPolicy | ||
) |
Definition at line 25 of file PayloadProxy.cc.
References gstats, cond::BasePayloadProxy::Stats::nProxy, asciidump::s, and stats.
cond::BasePayloadProxy::BasePayloadProxy | ( | cond::DbSession & | session, |
const std::string & | token, | ||
bool | errorPolicy | ||
) |
Definition at line 33 of file PayloadProxy.cc.
References cond::DbTransaction::commit(), gstats, cond::IOVProxy::load(), m_iov, m_session, cond::BasePayloadProxy::Stats::nProxy, asciidump::s, cond::DbTransaction::start(), stats, and cond::DbSession::transaction().
cond::BasePayloadProxy::~BasePayloadProxy | ( | ) | [virtual] |
Definition at line 46 of file PayloadProxy.cc.
{}
virtual void cond::BasePayloadProxy::invalidateCache | ( | ) | [pure virtual] |
IOVProxy const& cond::BasePayloadProxy::iov | ( | ) | const [inline] |
bool cond::BasePayloadProxy::isValid | ( | void | ) | const |
Definition at line 118 of file PayloadProxy.cc.
References cond::invalidTime(), m_element, cond::IOVElementProxy::since(), cond::IOVElementProxy::till(), and cond::IOVElementProxy::token().
Referenced by make().
{ return m_element.since()!=cond::invalidTime && m_element.till()!=cond::invalidTime && !m_element.token().empty(); }
virtual bool cond::BasePayloadProxy::load | ( | cond::DbSession & | session, |
std::string const & | token | ||
) | [private, pure virtual] |
Implemented in cond::PayloadProxy< cond::KeyList >, cond::PayloadProxy< DataT >, and cond::PayloadProxy< std::vector< cond::Time_t > >.
Referenced by make().
cond::ValidityInterval cond::BasePayloadProxy::loadFor | ( | cond::Time_t | time | ) |
Definition at line 64 of file PayloadProxy.cc.
References cond::IOVProxy::find(), m_element, m_iov, make(), cond::IOVElementProxy::since(), and cond::IOVElementProxy::till().
cond::ValidityInterval cond::BasePayloadProxy::loadFor | ( | size_t | n | ) |
Definition at line 70 of file PayloadProxy.cc.
References cond::IOVProxy::iov(), m_element, m_iov, make(), n, cond::IOVElementProxy::set(), cond::IOVElementProxy::since(), and cond::IOVElementProxy::till().
void cond::BasePayloadProxy::loadIov | ( | const std::string | iovToken | ) |
Definition at line 48 of file PayloadProxy.cc.
References cond::DbTransaction::commit(), invalidateCache(), cond::IOVProxy::load(), m_iov, m_session, cond::DbTransaction::start(), and cond::DbSession::transaction().
{ m_session.transaction().start(true); m_iov.load( iovToken ); m_session.transaction().commit(); invalidateCache(); }
virtual void cond::BasePayloadProxy::loadMore | ( | CondGetter const & | ) | [inline, virtual] |
Reimplemented in cond::PayloadProxy< cond::KeyList >.
Definition at line 83 of file PayloadProxy.h.
{}
void cond::BasePayloadProxy::loadTag | ( | const std::string | tag | ) |
Definition at line 55 of file PayloadProxy.cc.
References cond::DbTransaction::commit(), cond::MetaData::getToken(), invalidateCache(), cond::IOVProxy::load(), m_iov, m_session, cond::DbTransaction::start(), and cond::DbSession::transaction().
{ m_session.transaction().start(true); cond::MetaData metadata(m_session); std::string iovToken = metadata.getToken(tag); m_iov.load( iovToken ); m_session.transaction().commit(); invalidateCache(); }
void cond::BasePayloadProxy::make | ( | ) |
Definition at line 77 of file PayloadProxy.cc.
References cond::DbTransaction::commit(), Exception, gstats, cond::BasePayloadProxy::Stats::ids, cond::invalidTime(), isValid(), load(), m_doThrow, m_element, m_session, m_token, cond::BasePayloadProxy::Stats::nLoad, cond::BasePayloadProxy::Stats::nMake, convertSQLiteXML::ok, cond::IOVElementProxy::set(), cond::IOVElementProxy::since(), cond::DbTransaction::start(), stats, cond::IOVElementProxy::token(), token(), cond::DbSession::transaction(), and cms::Exception::what().
Referenced by loadFor().
{ ++gstats.nMake; ++stats.nMake; bool ok = false; if ( isValid()) { // check if (afterall) the payload is still the same... if (m_element.token()==token()) return; try { m_session.transaction().start(true); ok = load( m_session ,m_element.token()); m_session.transaction().commit(); if (ok) m_token = m_element.token(); } catch( const ora::Exception& e) { if (m_doThrow) throw cond::Exception(std::string("Condition Payload loader: ")+ e.what()); ok = false; } } if (!ok) { m_element.set(cond::invalidTime,cond::invalidTime,""); m_token.clear(); if (m_doThrow){ throw cond::Exception("Condition Payload loader: invalid data"); } } if (ok) { ++gstats.nLoad; ++stats.nLoad; stats.ids.push_back(ObjId()); fillIt(stats.ids.back(),m_token, m_element.since()); } }
bool cond::BasePayloadProxy::refresh | ( | ) |
Definition at line 124 of file PayloadProxy.cc.
References cond::DbTransaction::commit(), gstats, m_element, m_iov, m_session, cond::BasePayloadProxy::Stats::nArefresh, cond::BasePayloadProxy::Stats::nRefresh, cond::IOVProxy::refresh(), cond::DbTransaction::start(), stats, and cond::DbSession::transaction().
cond::ValidityInterval cond::BasePayloadProxy::setIntervalFor | ( | cond::Time_t | time | ) |
Definition at line 110 of file PayloadProxy.cc.
References cond::IOVProxy::find(), m_element, m_iov, cond::IOVElementProxy::since(), and cond::IOVElementProxy::till().
TimeType cond::BasePayloadProxy::timetype | ( | ) | const [inline] |
Definition at line 79 of file PayloadProxy.h.
References m_iov, and cond::IOVProxy::timetype().
{ return m_iov.timetype();}
std::string const& cond::BasePayloadProxy::token | ( | ) | const [inline] |
Definition at line 63 of file PayloadProxy.h.
References m_token.
Referenced by make().
{ return m_token;}
BasePayloadProxy::Stats cond::BasePayloadProxy::gstats = {0,0,0,0,0} [static] |
Definition at line 42 of file PayloadProxy.h.
Referenced by BasePayloadProxy(), make(), refresh(), and CondDBESSource::~CondDBESSource().
bool cond::BasePayloadProxy::m_doThrow [protected] |
Definition at line 94 of file PayloadProxy.h.
Referenced by make().
IOVElementProxy cond::BasePayloadProxy::m_element [protected] |
Definition at line 96 of file PayloadProxy.h.
Referenced by isValid(), loadFor(), make(), refresh(), and setIntervalFor().
IOVProxy cond::BasePayloadProxy::m_iov [protected] |
Definition at line 95 of file PayloadProxy.h.
Referenced by BasePayloadProxy(), iov(), loadFor(), loadIov(), loadTag(), refresh(), setIntervalFor(), and timetype().
DbSession cond::BasePayloadProxy::m_session [mutable, protected] |
Definition at line 97 of file PayloadProxy.h.
Referenced by BasePayloadProxy(), loadIov(), loadTag(), make(), and refresh().
std::string cond::BasePayloadProxy::m_token [protected] |
Definition at line 101 of file PayloadProxy.h.
Referenced by cond::PayloadProxy< std::vector< cond::Time_t > >::invalidateCache(), make(), and token().
Definition at line 44 of file PayloadProxy.h.
Referenced by BasePayloadProxy(), make(), and refresh().