9#ifndef IOVDBSVC_IOVDBFOLDER_H
10#define IOVDBSVC_IOVDBFOLDER_H
13#include "GaudiKernel/IClassIDSvc.h"
19#include "CoolKernel/ChannelSelection.h"
20#include "CoolKernel/ValidityKey.h"
21#include "CoolKernel/IFolder.h"
33#include "nlohmann/json.hpp"
54 const bool checklock,
const bool outputToFile=
false,
55 const std::string & source=
"COOL_DATABASE",
56 const std::string & crestServer=
"",
const std::string & crestTag=
"",
const bool crestCoolToFile=
false);
62 const std::string&
key()
const;
80 const std::string&
joTag()
const;
101 const unsigned int time);
109 bool cacheValid(
const cool::ValidityKey reftime)
const;
112 bool loadCache(
const cool::ValidityKey vkey,
const unsigned int cacheDiv,
113 const std::string& globalTag,
const bool ignoreMissChan);
120 bool getAddress(
const cool::ValidityKey reftime,IAddressCreator* persSvc,
121 const unsigned int poolSvcContext,
122 std::unique_ptr<IOpaqueAddress>& address,
123 IOVRange& range,
bool& poolPayloadRequested);
128 std::unique_ptr<SG::TransientAddress>
130 const unsigned int cacheRun,
131 const unsigned int cacheTime);
138 const std::string& globalTag,
139 const cool::IDatabasePtr& dbPtr,
146 bool resolveTag(
const cool::IFolderPtr&
fptr,
const std::string& globalTag);
160 void addIOVtoCache(cool::ValidityKey since, cool::ValidityKey until);
166 std::unique_ptr<SG::TransientAddress>
170 void setCacheLength(
const bool timeIs_nsOfEpoch,
const unsigned int cacheRun,
const unsigned int cacheTime);
176 const auto & objSince = obj.since();
177 const auto & objUntil = obj.until();
178 const auto & objChannel = obj.channelId();
179 ATH_MSG_DEBUG(
"from DB \t chID: "<<objChannel<<
"\tobjstart:\t"<<objSince<<
"\t objstop: \t"
185 unsigned int counter{};
191 const auto iovIdx = std::distance(
m_cachechan.begin(), pCacheChannel);
192 const auto & iov =
m_iovs.at(iovIdx);
193 if ((iov.first < objSince) and (objSince < iov.second)){
197 ATH_MSG_DEBUG(
"special reload needed on THIS ONE !!!!!!!!!!!");
200 m_iovs.extendIov(iovIdx, objSince-1);
204 if ( (objSince>=iov.first and objSince<iov.second) or (objUntil>iov.first and objUntil<=iov.second) ) covered=
true;
217 return objItr->goToNext();
222 return objItr->hasNext();
234 using IOVHash=std::pair<IOVDbNamespace::IovStore::Iov_t,std::string>;
239 std::vector<IOVHash>
fetchCrestIOVs(cool::ValidityKey since, cool::ValidityKey until);
242 std::vector<IOVHash>
fetchCrestObjects(cool::ValidityKey since, cool::ValidityKey until, cool::ValidityKey vkey);
247 void dumpFile(
const std::string& dumpName
248 ,
const cool::ValidityKey& vkey
252 ,
const cool::ValidityKey crestVkey=0
284 typedef std::pair<cool::ChannelId,cool::ChannelId>
ChanRange;
378 const auto & [cacheStart, cacheStop]=
m_iovs.getCacheBounds();
379 return ((reftime>cacheStart) and (reftime<cacheStop));
boost::shared_ptr< CoraCoolObjectIter > CoraCoolObjectIterPtr
Header for CoralCrestManager class.
uint32_t CLID
The Class ID type.
Basic time unit for IOVSvc.
helper class for IOVDbFolder managing cached iov since/until pairs
MsgStream & msg() const
The standard message stream.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
This class is a collection of AttributeLists where each one is associated with a channel number.
const bool m_crestCoolToFile
std::pair< IOVDbNamespace::IovStore::Iov_t, std::string > IOVHash
std::vector< unsigned int > m_cacheccend
std::vector< std::string > m_channames
bool multiVersion() const
coral::AttributeListSpecification * m_cachespec
const std::string m_crestServer
ITagInfoMgr * p_tagInfoMgr
IOVDbFolder(IOVDbConn *conn, const IOVDbParser &folderprop, MsgStream &msg, IClassIDSvc *clidsvc, IIOVDbMetaDataTool *metadatatool, const bool checklock, const bool outputToFile=false, const std::string &source="COOL_DATABASE", const std::string &crestServer="", const std::string &crestTag="", const bool crestCoolToFile=false)
cool::ValidityKey m_cachelength
bool loadCacheIfDbChanged(const cool::ValidityKey vkey, const std::string &globalTag, const cool::IDatabasePtr &dbPtr, const ServiceHandle< IIOVSvc > &iovSvc)
bool objectIteratorIsValid(CoraCoolObjectIterPtr &objItr)
std::vector< IOVHash > fetchCrestObjects(cool::ValidityKey since, cool::ValidityKey until, cool::ValidityKey vkey)
std::vector< coral::AttributeList > m_cacheattr
const std::string m_crestTag
unsigned int cacheUpdateImplementation(T &obj, const ServiceHandle< IIOVSvc > &iovSvc)
void specialCacheUpdate(CoraCoolObject &obj, const ServiceHandle< IIOVSvc > &iovSvc)
unsigned long long bytesRead() const
std::pair< cool::ValidityKey, size_t > IOV2Index
void dumpFile(const std::string &dumpName, const cool::ValidityKey &vkey, IOVDbNamespace::Cool2Json *json, bool skipCoolIoV, CoralCrestManager *mng=NULL, const cool::ValidityKey crestVkey=0) const
bool magicTag(std::string &tag)
cool::ValidityKey m_iovoverride
bool iovOverridden() const
IOVDbNamespace::FolderType m_foldertype
std::optional< CoralCrestManager > m_crest_mng
bool objectIteratorIsValid(cool::IObjectIteratorPtr &objItr)
bool fromMetaDataOnly() const
bool overrideOptionsFromParsedDescription(const IOVDbParser &parsedDescription)
cool::ValidityKey iovTime(const IOVTime &reftime) const
void setTagOverride(const std::string &tag, const bool setFlag)
bool addMetaAttrList(const coral::AttributeList &atrlist, const IOVRange &range)
void setCacheLength(const bool timeIs_nsOfEpoch, const unsigned int cacheRun, const unsigned int cacheTime)
std::vector< IOVHash > fetchCrestIOVs(cool::ValidityKey since, cool::ValidityKey until)
unsigned long long m_nbytesread
const std::string & key() const
const IOVRange & currentRange() const
std::vector< cool::ChannelId > m_cachechan
std::string m_folderDescription
bool loadCache(const cool::ValidityKey vkey, const unsigned int cacheDiv, const std::string &globalTag, const bool ignoreMissChan)
void setIOVOverride(const unsigned int run, const unsigned int lumiblock, const unsigned int time)
void setDropped(const bool dropped)
std::unique_ptr< SG::TransientAddress > createTransientAddress(const std::vector< std::string > &symlinks)
IIOVDbMetaDataTool * p_metaDataTool
void setFolderDescription(const std::string &description)
std::unique_ptr< SG::TransientAddress > preLoadFolder(ITagInfoMgr *tagInfoMgr, const unsigned int cacheRun, const unsigned int cacheTime)
bool addMetaAttrListColl(const CondAttrListCollection *coll)
std::pair< cool::ChannelId, cool::ChannelId > ChanRange
bool cacheValid(const cool::ValidityKey reftime) const
void addIOVtoCache(cool::ValidityKey since, cool::ValidityKey until)
std::vector< unsigned int > m_cacheccstart
bool getAddress(const cool::ValidityKey reftime, IAddressCreator *persSvc, const unsigned int poolSvcContext, std::unique_ptr< IOpaqueAddress > &address, IOVRange &range, bool &poolPayloadRequested)
bool resolveTag(const cool::IFolderPtr &fptr, const std::string &globalTag)
const std::string & eventStore() const
const bool m_outputToFile
IOVDbNamespace::FolderType folderType() const
std::vector< cool::ChannelId > m_channums
const std::string & joTag() const
unsigned int m_ncacheread
cool::ChannelSelection m_chansel
const std::string & resolvedTag() const
IOVDbNamespace::IovStore m_iovs
void setSharedSpec(const coral::AttributeList &atrlist)
const std::string m_source
std::vector< ChanRange > m_chanrange
const std::string & folderName() const
Basic time unit for IOVSvc.
This is a Athena service which manages detector description tag information.
The Athena Transient Store API.
std::vector< TFile * > fptr
std::string description
glabal timer - how long have I taken so far?