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;
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(
275 m_data->tagInfo.name,
m_data->snapshotTime,
ret.lastInterval.since,
ret.lastInterval.payloadId);
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;
399 bool ok =
m_session->iovSchema().iovTable().getLastIov(