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;
50 retVal.
till = m_parent->m_tagInfo.endOfValidity;
52 retVal.
payloadId = std::get<1>(*m_current);
134 boost::posix_time::ptime notime;
149 m_data->tagInfo.payloadType,
150 m_data->tagInfo.synchronizationType,
151 m_data->tagInfo.endOfValidity,
152 m_data->tagInfo.lastValidatedTime)) {
170 m_data->cacheInitialized =
true;
174 boost::posix_time::ptime no_time;
184 m_session->iovSchema().iovTable().select(
190 boost::posix_time::ptime no_time;
198 throwException(
"No tag has been loaded.",
"IOVProxy::selectRange");
210 throwException(
"No tag has been loaded.",
"IOVProxy::selectRange");
214 boost::posix_time::ptime no_time;
232 m_data->sinceGroups.clear();
233 m_data->iovSequence.clear();
234 m_data->numberOfQueries = 0;
249 if (
target.since >= endOfValidity) {
252 target.till = endOfValidity;
261 throwException(
"No tag has been loaded.",
"IOVProxy::iovSequenceInfo");
266 bool ok =
m_session->iovSchema().iovTable().getLastIov(
267 m_data->tagInfo.name,
m_data->snapshotTime,
ret.lastInterval.since,
ret.lastInterval.payloadId);
276 throwException(
"No tag has been loaded.",
"IOVProxy::getMetadata");
278 std::tuple<std::string, boost::posix_time::ptime, boost::posix_time::ptime>
ret;
279 if (!
m_session->iovSchema().tagTable().getMetadata(
280 m_data->tagInfo.name, std::get<0>(
ret), std::get<1>(
ret), std::get<2>(
ret))) {
281 throwException(
"Metadata for tag \"" +
m_data->tagInfo.name +
"\" have not been found in the database.",
282 "IOVProxy::getMetadata");
290 if (!
m_session->isTransactionActive(
false))
295 m_data->iovSequence.clear();
296 m_session->iovSchema().iovTable().select(
297 m_data->tagInfo.name, lowerGroup, higherGroup,
m_data->snapshotTime,
m_data->iovSequence);
299 if (
m_data->iovSequence.empty()) {
304 m_data->groupLowerIov = std::get<0>(
m_data->iovSequence.front());
308 m_data->groupHigherIov = std::get<0>(
m_data->iovSequence.back());
316 m_data->numberOfQueries++;
323 throwException(
"No tag has been loaded.",
"IOVProxy::getInterval");
325 if (!
m_data->cacheInitialized)
331 time < m_data->groupLowerIov ||
time >=
m_data->groupHigherIov) {
336 if (iGLow ==
m_data->sinceGroups.end()) {
344 if (iGHigh !=
m_data->sinceGroups.end())
353 if (iIov ==
m_data->iovSequence.end()) {
357 retVal.
since = std::get<0>(*iIov);
368 tillVal =
m_data->groupHigherIov;
370 if (tillVal < retVal.
till)
371 retVal.
till = tillVal;
375 if (defaultIovSize == 0) {
380 retVal.
till = retVal.
since + defaultIovSize - 1;
391 bool ok =
m_session->iovSchema().iovTable().getLastIov(