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;
141 load(tagName, notime);
154 if (!
m_session->iovSchema().tagTable().select(tagName,
156 m_data->tagInfo.payloadType,
157 m_data->tagInfo.synchronizationType,
158 m_data->tagInfo.endOfValidity,
159 m_data->tagInfo.lastValidatedTime,
161 throwException(
"Tag \"" + tagName +
"\" has not been found in the database.",
"IOVProxy::load");
163 m_data->tagInfo.name = tagName;
164 m_data->snapshotTime = snapshotTime;
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;
204 const boost::posix_time::ptime& snapshotTime) {
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;
223 size_t prevSize = destination.size();
224 m_session->iovSchema().iovTable().getRange(
m_data->tagInfo.name, begin, end, no_time, destination);
225 size_t niov = destination.size() - prevSize;
240 m_data->sinceGroups.clear();
241 m_data->iovSequence.clear();
242 m_data->numberOfQueries = 0;
257 if (target.
since >= endOfValidity) {
260 target.
till = endOfValidity;
269 throwException(
"No tag has been loaded.",
"IOVProxy::iovSequenceInfo");
274 bool ok =
m_session->iovSchema().iovTable().getLastIov(
284 throwException(
"No tag has been loaded.",
"IOVProxy::getMetadata");
286 std::tuple<std::string, boost::posix_time::ptime, boost::posix_time::ptime>
ret;
287 if (!
m_session->iovSchema().tagTable().getMetadata(
288 m_data->tagInfo.name, std::get<0>(ret), std::get<1>(ret), std::get<2>(ret))) {
289 throwException(
"Metadata for tag \"" +
m_data->tagInfo.name +
"\" have not been found in the database.",
290 "IOVProxy::getMetadata");
298 if (!
m_session->isTransactionActive(
false))
303 m_data->iovSequence.clear();
304 m_session->iovSchema().iovTable().select(
305 m_data->tagInfo.name, lowerGroup, higherGroup,
m_data->snapshotTime,
m_data->iovSequence);
307 if (
m_data->iovSequence.empty()) {
312 m_data->groupLowerIov = std::get<0>(
m_data->iovSequence.front());
316 m_data->groupHigherIov = std::get<0>(
m_data->iovSequence.back());
324 m_data->numberOfQueries++;
331 throwException(
"No tag has been loaded.",
"IOVProxy::getInterval");
333 if (!
m_data->cacheInitialized)
339 time < m_data->groupLowerIov || time >=
m_data->groupHigherIov) {
344 if (iGLow ==
m_data->sinceGroups.end()) {
352 if (iGHigh !=
m_data->sinceGroups.end())
361 if (iIov ==
m_data->iovSequence.end()) {
365 retVal.
since = std::get<0>(*iIov);
376 tillVal =
m_data->groupHigherIov;
378 if (tillVal < retVal.
till)
379 retVal.
till = tillVal;
383 if (defaultIovSize == 0) {
388 retVal.
till = retVal.
since + defaultIovSize - 1;
389 if (time > retVal.
till)
399 bool ok =
m_session->iovSchema().iovTable().getLastIov(
void fetchSequence(cond::Time_t lowerGroup, cond::Time_t higherGroup)
void checkTransaction(const std::string &ctx) const
tuple ret
prodAgent to be discontinued
cond::TagInfo_t iovSequenceInfo() const
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)
IOVProxy & operator=(const IOVProxy &rhs)
void setTillToLastIov(cond::Iov_t &target, cond::Time_t endOfValidity)
std::vector< T >::const_iterator search(const cond::Time_t &val, const std::vector< T > &container)
Iterator find(cond::Time_t time) const
__host__ __device__ constexpr RandomIt upper_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
std::unique_ptr< IOVContainer > m_array
std::pair< cond::Time_t, cond::Time_t > loadedGroup() const
std::vector< std::tuple< cond::Time_t, cond::Hash > > IOVContainer
std::tuple< std::string, boost::posix_time::ptime, boost::posix_time::ptime > getMetadata() 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.
cond::Iov_t getInterval(cond::Time_t time)
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::Tag_t tagInfo() const
cond::Time_t groupHigherIov
cond::Time_t groupLowerIov
std::vector< cond::Time_t > sinceGroups
bool operator==(const Iterator &rhs) const
size_t numberOfQueries() 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)
bool operator!=(const Iterator &rhs) const
Time_t sinceGroupSize(TimeType tp)
const std::shared_ptr< SessionImpl > & session() const