9 namespace persistency {
16 return (
x < std::get<0>(y));
23 if (container.empty())
24 return container.end();
26 return (
p != container.begin()) ?
p - 1 : container.end();
32 : m_current(current), m_parent(
parent) {}
46 retVal.
since = std::get<0>(*m_current);
47 auto next = m_current;
49 if (
next == m_parent->m_array->end()) {
55 if (retVal.
till > m_parent->m_tagInfo.endOfValidity) {
56 retVal.
till = m_parent->m_tagInfo.endOfValidity;
58 retVal.
payloadId = std::get<1>(*m_current);
141 boost::posix_time::ptime notime;
157 m_data->tagInfo.payloadType,
158 m_data->tagInfo.synchronizationType,
159 m_data->tagInfo.endOfValidity,
160 m_data->tagInfo.lastValidatedTime,
179 m_data->cacheInitialized =
true;
183 boost::posix_time::ptime no_time;
193 m_session->iovSchema().iovTable().select(
199 boost::posix_time::ptime no_time;
207 throwException(
"No tag has been loaded.",
"IOVProxy::selectRange");
219 throwException(
"No tag has been loaded.",
"IOVProxy::selectRange");
223 boost::posix_time::ptime no_time;
234 m_data->sinceGroups.clear();
235 m_data->iovSequence.clear();
236 m_data->numberOfQueries = 0;
251 if (
target.since >= endOfValidity) {
254 target.till = endOfValidity;
263 throwException(
"No tag has been loaded.",
"IOVProxy::iovSequenceInfo");
268 bool ok =
m_session->iovSchema().iovTable().getLastIov(
269 m_data->tagInfo.name,
m_data->snapshotTime,
ret.lastInterval.since,
ret.lastInterval.payloadId);
278 throwException(
"No tag has been loaded.",
"IOVProxy::getMetadata");
280 std::tuple<std::string, boost::posix_time::ptime, boost::posix_time::ptime>
ret;
281 if (!
m_session->iovSchema().tagTable().getMetadata(
282 m_data->tagInfo.name, std::get<0>(
ret), std::get<1>(
ret), std::get<2>(
ret))) {
283 throwException(
"Metadata for tag \"" +
m_data->tagInfo.name +
"\" have not been found in the database.",
284 "IOVProxy::getMetadata");
292 if (!
m_session->isTransactionActive(
false))
297 bool firstTime =
m_data->iovSequence.empty();
298 m_data->iovSequence.clear();
299 m_session->iovSchema().iovTable().select(
300 m_data->tagInfo.name, lowerGroup, higherGroup,
m_data->snapshotTime,
m_data->iovSequence);
302 if (
m_data->iovSequence.empty()) {
307 m_data->groupLowerIov = std::get<0>(
m_data->iovSequence.front());
311 m_data->groupHigherIov = std::get<0>(
m_data->iovSequence.back());
319 edm::LogSystem(
"NewIOV") <<
"Fetched new IOV for '" <<
m_data->tagInfo.name <<
"' request interval [ " 320 << lowerGroup <<
" , " << higherGroup <<
" ] new range [ " <<
m_data->groupLowerIov
321 <<
" , " <<
m_data->groupHigherIov <<
" ] #entries " <<
m_data->iovSequence.size();
324 m_data->numberOfQueries++;
329 throwException(
"No tag has been loaded.",
"IOVProxy::getInterval");
331 if (!
m_data->cacheInitialized)
337 time < m_data->groupLowerIov ||
time >=
m_data->groupHigherIov) {
342 if (iGLow ==
m_data->sinceGroups.end()) {
350 if (iGHigh !=
m_data->sinceGroups.end())
359 if (iIov ==
m_data->iovSequence.end()) {
363 retVal.
since = std::get<0>(*iIov);
374 tillVal =
m_data->groupHigherIov;
376 if (tillVal < retVal.
till)
377 retVal.
till = tillVal;
386 bool ok =
m_session->iovSchema().iovTable().getLastIov(
void fetchSequence(cond::Time_t lowerGroup, cond::Time_t higherGroup)
Log< level::System, false > LogSystem
std::shared_ptr< SessionImpl > m_session
bool operator()(const cond::Time_t &x, const std::tuple< cond::Time_t, cond::Hash > &y)
bool operator()(const cond::Time_t &x, const cond::Time_t &y)
std::tuple< std::string, boost::posix_time::ptime, boost::posix_time::ptime > getMetadata() const
IOVProxy & operator=(const IOVProxy &rhs)
std::pair< cond::Time_t, cond::Time_t > loadedGroup() const
cond::TagInfo_t iovSequenceInfo() const
void setTillToLastIov(cond::Iov_t &target, cond::Time_t endOfValidity)
ret
prodAgent to be discontinued
std::vector< T >::const_iterator search(const cond::Time_t &val, const std::vector< T > &container)
size_t numberOfQueries() const
constexpr Process operator++(Process p)
std::unique_ptr< IOVContainer > m_array
std::vector< std::tuple< cond::Time_t, cond::Hash > > IOVContainer
bool operator==(const Iterator &rhs) const
unsigned long long Time_t
const cond::Tag_t & tagInfo() const
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
const std::shared_ptr< SessionImpl > & session() const
cond::Iov_t getInterval(cond::Time_t time)
Iterator find(cond::Time_t time) const
void checkTransaction(const std::string &ctx) const
cond::Tag_t tagInfo() const
const IOVArray * m_parent
boost::posix_time::ptime snapshotTime
std::shared_ptr< IOVProxyData > m_data
Time_t tillTimeFromNextSince(Time_t nextSince, TimeType timeType)
void load(const std::string &tag)
IOVContainer::const_iterator m_current
IOVArray selectRange(const cond::Time_t &begin, const cond::Time_t &end)
cond::Time_t groupHigherIov
cond::Time_t groupLowerIov
std::vector< cond::Time_t > sinceGroups
bool operator!=(const Iterator &rhs) const
IOVArray & operator=(const IOVArray &rhs)
const Time_t MAX_VAL(std::numeric_limits< Time_t >::max())
void throwException(const std::string &message, const std::string &methodName)
Iterator & operator=(const Iterator &rhs)
Time_t sinceGroupSize(TimeType tp)