8 namespace persistency {
15 return (
x < std::get<0>(y));
22 if (container.empty())
23 return container.end();
25 return (
p != container.begin()) ?
p - 1 : container.end();
31 : m_current(current), m_parent(
parent) {}
45 retVal.
since = std::get<0>(*m_current);
46 auto next = m_current;
48 if (
next == m_parent->m_array->end()) {
54 if (retVal.
till > m_parent->m_tagInfo.endOfValidity) {
55 retVal.
till = m_parent->m_tagInfo.endOfValidity;
57 retVal.
payloadId = std::get<1>(*m_current);
140 boost::posix_time::ptime notime;
156 m_data->tagInfo.payloadType,
157 m_data->tagInfo.synchronizationType,
158 m_data->tagInfo.endOfValidity,
159 m_data->tagInfo.lastValidatedTime,
178 m_data->cacheInitialized =
true;
182 boost::posix_time::ptime no_time;
192 m_session->iovSchema().iovTable().select(
198 boost::posix_time::ptime no_time;
206 throwException(
"No tag has been loaded.",
"IOVProxy::selectRange");
218 throwException(
"No tag has been loaded.",
"IOVProxy::selectRange");
222 boost::posix_time::ptime no_time;
233 m_data->sinceGroups.clear();
234 m_data->iovSequence.clear();
235 m_data->numberOfQueries = 0;
250 if (
target.since >= endOfValidity) {
253 target.till = endOfValidity;
262 throwException(
"No tag has been loaded.",
"IOVProxy::iovSequenceInfo");
267 bool ok =
m_session->iovSchema().iovTable().getLastIov(
268 m_data->tagInfo.name,
m_data->snapshotTime,
ret.lastInterval.since,
ret.lastInterval.payloadId);
277 throwException(
"No tag has been loaded.",
"IOVProxy::getMetadata");
279 std::tuple<std::string, boost::posix_time::ptime, boost::posix_time::ptime>
ret;
280 if (!
m_session->iovSchema().tagTable().getMetadata(
281 m_data->tagInfo.name, std::get<0>(
ret), std::get<1>(
ret), std::get<2>(
ret))) {
282 throwException(
"Metadata for tag \"" +
m_data->tagInfo.name +
"\" have not been found in the database.",
283 "IOVProxy::getMetadata");
291 if (!
m_session->isTransactionActive(
false))
296 m_data->iovSequence.clear();
297 m_session->iovSchema().iovTable().select(
298 m_data->tagInfo.name, lowerGroup, higherGroup,
m_data->snapshotTime,
m_data->iovSequence);
300 if (
m_data->iovSequence.empty()) {
305 m_data->groupLowerIov = std::get<0>(
m_data->iovSequence.front());
309 m_data->groupHigherIov = std::get<0>(
m_data->iovSequence.back());
317 m_data->numberOfQueries++;
322 throwException(
"No tag has been loaded.",
"IOVProxy::getInterval");
324 if (!
m_data->cacheInitialized)
330 time < m_data->groupLowerIov ||
time >=
m_data->groupHigherIov) {
335 if (iGLow ==
m_data->sinceGroups.end()) {
343 if (iGHigh !=
m_data->sinceGroups.end())
352 if (iIov ==
m_data->iovSequence.end()) {
356 retVal.
since = std::get<0>(*iIov);
367 tillVal =
m_data->groupHigherIov;
369 if (tillVal < retVal.
till)
370 retVal.
till = tillVal;
379 bool ok =
m_session->iovSchema().iovTable().getLastIov(
void fetchSequence(cond::Time_t lowerGroup, cond::Time_t higherGroup)
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
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)