ATLAS Offline Software
Loading...
Searching...
No Matches
IOVSvc Class Reference

#include <IOVSvc.h>

Inheritance diagram for IOVSvc:
Collaboration diagram for IOVSvc:

Public Member Functions

 IOVSvc (const std::string &name, ISvcLocator *svc)
virtual StatusCode initialize () override
virtual StatusCode reinitialize () override
virtual StatusCode createIOVTool (const std::string &storeName) override
virtual std::vector< std::string > getStoreNames () const override
virtual StatusCode setRange (const CLID &clid, const std::string &key, IOVRange &) override
 Update Range from dB.
virtual StatusCode setRange (const CLID &clid, const std::string &key, IOVRange &io, const std::string &storeName) override
virtual StatusCode getRange (const CLID &clid, const std::string &key, IOVRange &io) const override
virtual StatusCode regProxy (SG::DataProxy *proxy, const std::string &key, const std::string &storeName) override
 Subscribe method for DataProxy. key StoreGate key.
virtual StatusCode replaceProxy (SG::DataProxy *pOld, SG::DataProxy *pNew, const std::string &storeName) override
 replace a registered DataProxy with a new version
virtual StatusCode regProxy (const CLID &clid, const std::string &key, const std::string &storeName) override
 Another way to subscribe.
virtual StatusCode deregProxy (SG::DataProxy *proxy) override
 Deregister a DataProxy with the service.
virtual StatusCode deregProxy (const CLID &clid, const std::string &key) override
 Deregister a DataProxy with the service.
virtual StatusCode getRangeFromDB (const CLID &clid, const std::string &key, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa, const EventIDBase &now) const override
 Get IOVRange from db for current event.
virtual StatusCode getRangeFromDB (const CLID &clid, const std::string &key, const IOVTime &time, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa) const override
 Get IOVRange from db for a particular event.
virtual StatusCode setRangeInDB (const CLID &clid, const std::string &key, const IOVRange &range, const std::string &tag) override
 Set a particular IOVRange in db (and memory)
virtual StatusCode dropObjectFromDB (const CLID &clid, const std::string &key, const std::string &storeName) override
 Drop the associated object from the db and trigger reload.
virtual StatusCode preLoadTAD (const SG::TransientAddress *, const std::string &storeName) override
 supply a list of TADs whose proxies will be preloaded
virtual StatusCode preLoadDataTAD (const SG::TransientAddress *, const std::string &storeName) override
 supply a list of TADs whose data will be preloaded
virtual void resetAllProxies () override
virtual void ignoreProxy (const CLID &clid, const std::string &key, const std::string &storeName) override
 ignore proxy
virtual StatusCode createCondObj (CondContBase *, const DataObjID &, const EventIDBase &) override

Private Member Functions

StatusCode createIOVTool (const std::string &storeName, IIOVSvcTool *&tool)
IIOVSvcToolgetTool (const std::string &storeName, bool createIF=true)
IIOVSvcToolgetTool (const CLID &clid, const std::string &key) const
IIOVSvcToolgetTool (SG::DataProxy *proxy) const
std::string fullProxyName (const SG::DataProxy *proxy) const
std::string fullProxyName (const CLID &clid, const std::string &key) const

Private Attributes

Gaudi::Property< bool > m_preLoadRanges {this, "preLoadRanges", false}
Gaudi::Property< bool > m_preLoadData {this, "preLoadData", false}
Gaudi::Property< bool > m_partialPreLoadData {this, "partialPreloadData", true}
Gaudi::Property< bool > m_preLoadExtensibleFolders {this, "preLoadExtensibleFolders", true}
Gaudi::Property< bool > m_sortKeys {this, "sortKeys", true}
Gaudi::Property< bool > m_forceReset {this, "forceResetAtBeginRun", false}
Gaudi::Property< std::string > m_updateInterval {this, "updateInterval", "Event"}
ServiceHandle< IToolSvc > p_toolSvc
ServiceHandle< IClassIDSvc > p_CLIDSvc
ServiceHandle< StoreGateSvcp_sgs
ServiceHandle< StoreGateSvcp_detStore
ServiceHandle< ICondSvc > p_condSvc
std::map< std::string, IIOVSvcTool * > m_toolMap
std::recursive_mutex m_lock

Detailed Description

Definition at line 45 of file IOVSvc.h.

Constructor & Destructor Documentation

◆ IOVSvc()

IOVSvc::IOVSvc ( const std::string & name,
ISvcLocator * svc )

Definition at line 65 of file IOVSvc.cxx.

66 : base_class( name, svc ),
67 p_toolSvc("ToolSvc",name),
68 p_CLIDSvc("ClassIDSvc",name),
69 p_sgs("StoreGateSvc",name),
70 p_detStore("StoreGateSvc/DetectorStore",name),
71 p_condSvc("CondSvc",name)
72{
73}
ServiceHandle< StoreGateSvc > p_detStore
Definition IOVSvc.h:146
ServiceHandle< IClassIDSvc > p_CLIDSvc
Definition IOVSvc.h:145
ServiceHandle< StoreGateSvc > p_sgs
Definition IOVSvc.h:146
ServiceHandle< IToolSvc > p_toolSvc
Definition IOVSvc.h:144
ServiceHandle< ICondSvc > p_condSvc
Definition IOVSvc.h:147

Member Function Documentation

◆ createCondObj()

StatusCode IOVSvc::createCondObj ( CondContBase * ccb,
const DataObjID & id,
const EventIDBase & now )
overridevirtual

Definition at line 650 of file IOVSvc.cxx.

651 {
652
653 ATH_MSG_DEBUG("createCondObj: id: " << id << " t: " << now << " valid: "
654 << ccb->valid(now));
655
656 if (ccb->valid(now)) {
657 if (msgLvl(MSG::DEBUG)) {
658 EventIDRange r;
659 ccb->range(now,r);
660 ATH_MSG_DEBUG( " range " << r << " for " << id
661 << " is still valid at " << now );
662 }
663 return StatusCode::SUCCESS;
664 }
665
666 IOVTime t(now.run_number(), now.lumi_block(),
667 now.time_stamp()*1000000000LL + now.time_stamp_ns_offset());
668
669 // remove storename from key
670 std::string sgKey = id.key();
671 auto sep = sgKey.find('+');
672 if (sep != std::string::npos) {
673 sgKey.erase(0,sep+1);
674 }
675
676 std::unique_ptr<IOpaqueAddress> ioa;
677 std::string tag;
678 IOVRange range;
679 if (getRangeFromDB(id.clid(), sgKey, t, range, tag, ioa).isFailure()) {
680 ATH_MSG_ERROR( "unable to get range from db for time " << t << " clid "
681 << id.clid() << " " << sgKey );
682 return StatusCode::FAILURE;
683 }
684
685 //In case the conditons-container is a 'mixed' type, we need both run/lb and time-stamps in the range.
686 //Assume infinite IOV in the other dimension
687 EventIDRange eidRange(range);
689 eidRange=EventIDRange::intersect(IOVInfiniteRange::infiniteMixed(),eidRange);
690 }
691 ATH_MSG_DEBUG( " new range for ID " << id << " : " << range
692 << " IOA: " << ioa.get());
693
694 // If the start of the new range matches the start of the last range, then
695 // extend the last range rather than trying to insert a new range.
696 // This can happen when a folder is tagged as `extensible' in IOVDbSvc.
697 EventIDRange r;
698 if (ccb->range (eidRange.start(), r) &&
699 eventIDMatch (r.start(), eidRange.start()))
700 {
701 if (ccb->extendLastRange (eidRange).isSuccess()) {
702 return StatusCode::SUCCESS;
703 }
704 }
705
706 if (ccb->proxy() == nullptr) {
707 // nb. We don't want to be holding the IOVSvc lock here,
708 // as SGImplSvc can call to IOVSvc with the store lock held.
709 SG::DataProxy* dp = p_detStore->proxy (id.clid(), sgKey);
710 ATH_MSG_DEBUG( " found DataProxy " << dp << " for " << id );
711 ccb->setProxy(dp);
712 }
713
714 // this will talk to the IOVDbSvc, get current run/event from EventInfo
715 // object, load
716 SG::DataProxy* dp = ccb->proxy();
717 DataObject* dobj = nullptr;
718 void* v = nullptr;
719
720 if (dp->store()->createObj(dp->loader(), ioa.get(), dobj).isFailure()) {
721 ATH_MSG_ERROR(" could not create a new DataObject ");
722 return StatusCode::FAILURE;
723 } else {
724 ATH_MSG_DEBUG(" created new obj at " << dobj );
725
726 v = SG::Storable_cast(dobj, id.clid());
727 }
728
729 // Free the DataBucket that was created along with the object we read.
730 if (DataBucketBase* dbb = dynamic_cast<DataBucketBase*> (dobj)) {
731 dbb->relinquish();
732 delete dobj;
733 dobj = nullptr;
734 }
735
736 // Some data objects may be reference counted by the address.
737 // CondCont will take ownership of the object, but doesn't
738 // do refcounting. We'll have gotten a reference via the Storable_cast
739 // above, so it should be ok ... unless CondCont deletes
740 // the new object immediately instead of inserting.
741 // In that case, when we delete the address, it will
742 // follow an invalid pointer. So be sure to delete
743 // the address before the object is added to CondCont.
744 ioa.reset();
745
746 // DataObject *d2 = static_cast<DataObject*>(v);
747
748 ATH_MSG_DEBUG( " SG::Storable_cast to obj: " << v );
749
750 StatusCode sc = ccb->typelessInsert (eidRange, v);
751 if (!sc.isSuccess()) {
752 ATH_MSG_ERROR("unable to insert Object at " << v << " into CondCont "
753 << ccb->id() << " for range " << eidRange );
754 return StatusCode::FAILURE;
755 }
757 // Disable this for now... IOVDbSvc can sometimes produce overlapping
758 // ranges.
759 //ATH_MSG_ERROR ("IOV range overlap.");
760 //return StatusCode::FAILURE;
761 }
762
763 return sc;
764
765}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
static bool isOverlap(code_t code)
Helper to test whether a code is OVERLAP.
Definition CondCont.cxx:242
void setProxy(SG::DataProxy *)
Set the associated DataProxy.
Definition CondCont.cxx:276
@ MIXED
Mixed Run+lbn / timestamp container.
Definition CondCont.h:192
virtual StatusCode typelessInsert(const EventIDRange &r, void *obj, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Insert a new conditions object.
virtual StatusCode extendLastRange(const EventIDRange &newRange, const EventContext &ctx=Gaudi::Hive::currentContext())=0
Extend the range of the last IOV.
virtual bool valid(const EventIDBase &t) const =0
Test to see if a given IOV time is mapped in the container.
KeyType keyType() const
Return the key type for this container.
virtual bool range(const EventIDBase &t, EventIDRange &r) const =0
Return the mapped validity range for an IOV time.
SG::DataProxy * proxy()
Return the associated DataProxy, if any.
const DataObjID & id() const
Return CLID/key corresponding to this container.
static EventIDRange infiniteMixed()
Produces an mixed EventIDRange that is infinite in Time and RunLumi.
virtual StatusCode getRangeFromDB(const CLID &clid, const std::string &key, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa, const EventIDBase &now) const override
Get IOVRange from db for current event.
Definition IOVSvc.cxx:407
int r
Definition globals.cxx:22
::StatusCode StatusCode
StatusCode definition for legacy code.
T * Storable_cast(DataObject *pDObj, bool quiet=true, IRegisterTransient *irt=0, bool isConst=true)

◆ createIOVTool() [1/2]

StatusCode IOVSvc::createIOVTool ( const std::string & storeName)
overridevirtual

Definition at line 529 of file IOVSvc.cxx.

530{
531 IIOVSvcTool* ist = nullptr;
532 return createIOVTool (storeName, ist);
533}
virtual StatusCode createIOVTool(const std::string &storeName) override
Definition IOVSvc.cxx:529

◆ createIOVTool() [2/2]

StatusCode IOVSvc::createIOVTool ( const std::string & storeName,
IIOVSvcTool *& tool )
private

Definition at line 490 of file IOVSvc.cxx.

490 {
491
492 std::string store(storeName);
493 std::string toolName("IOVSvcTool");
494 if (storeName == "default") {
495 store = defaultStore;
496 }
497 else {
498 // Append the store name if not default
499 toolName += '_';
500 toolName += store;
501 }
502
503 ATH_MSG_DEBUG( "Creating " << toolName << " associated with store \"" << store
504 << "\"" );
505
506 const auto itr = m_toolMap.find( store );
507 if ( itr == m_toolMap.end() ) {
508 ist = nullptr;
509 if (p_toolSvc->retrieveTool( "IOVSvcTool/" + toolName, ist, this ).isFailure()) {
510 ATH_MSG_ERROR( "Unable to create IOVSvcTool associated with store \""
511 << store << "\"" );
512 return StatusCode::FAILURE;
513 } else {
514 m_toolMap[ store ] = ist;
515 ist->setStoreName( store );
516 return StatusCode::SUCCESS;
517 }
518 } else {
519 ATH_MSG_INFO( "an IOVSvcTool already exists associated with store \""
520 << store << "\"" );
521 ist = itr->second;
522 return StatusCode::SUCCESS;
523 }
524
525}
#define ATH_MSG_INFO(x)
std::map< std::string, IIOVSvcTool * > m_toolMap
Definition IOVSvc.h:149
TestStore store
Definition TestStore.cxx:23

◆ deregProxy() [1/2]

StatusCode IOVSvc::deregProxy ( const CLID & clid,
const std::string & key )
overridevirtual

Deregister a DataProxy with the service.

Definition at line 190 of file IOVSvc.cxx.

190 {
191
192 std::scoped_lock lock(m_lock);
193 IIOVSvcTool *ist = getTool( clid, key );
194 if (ist == nullptr) {
195 ATH_MSG_ERROR( "deregProxy: no IOVSvcTool found for proxy "
196 << fullProxyName(clid,key) );
197 return StatusCode::FAILURE;
198 }
199
200 return ist->deregProxy( clid, key );
201
202}
virtual StatusCode deregProxy(SG::DataProxy *proxy)=0
std::recursive_mutex m_lock
Definition IOVSvc.h:153
IIOVSvcTool * getTool(const std::string &storeName, bool createIF=true)
Definition IOVSvc.cxx:539
std::string fullProxyName(const SG::DataProxy *proxy) const
Definition IOVSvc.cxx:593

◆ deregProxy() [2/2]

StatusCode IOVSvc::deregProxy ( SG::DataProxy * proxy)
overridevirtual

Deregister a DataProxy with the service.

Definition at line 170 of file IOVSvc.cxx.

170 {
171
172 std::scoped_lock lock(m_lock);
173 IIOVSvcTool *ist = getTool( proxy );
174 if (ist == nullptr) {
175 ATH_MSG_ERROR( "deregProxy: no IOVSvcTool found for proxy "
176 << fullProxyName( proxy ) );
177 return StatusCode::FAILURE;
178 }
179
180 return ist->deregProxy( proxy );
181
182}

◆ dropObjectFromDB()

StatusCode IOVSvc::dropObjectFromDB ( const CLID & clid,
const std::string & key,
const std::string & storeName )
overridevirtual

Drop the associated object from the db and trigger reload.

Definition at line 351 of file IOVSvc.cxx.

352 {
353
354 std::scoped_lock lock(m_lock);
355
356 IIOVSvcTool *ist = getTool( clid, key );
357 if (ist == nullptr) {
358 ATH_MSG_ERROR( "dropObjectFromDB: no IOVSvcTool associated with store "
359 << storeName << " and failed to create one." );
360 return StatusCode::FAILURE;
361 }
362
363 SG::DataProxy* proxy = p_detStore->proxy(clid, key);
364 if (proxy == nullptr) {
365 ATH_MSG_DEBUG("Proxy for (clid: " << clid << " key: " << key << ") in store " << storeName
366 << " does not exist. Cannot drop associated object.");
367 return StatusCode::SUCCESS;
368 }
369
370 // Set IOV in the past to trigger reload on next range check
371 IOVRange iovr(IOVTime(0, 0), IOVTime(0, 0));
372 ATH_CHECK( ist->setRange(clid, key, iovr) );
373
374 IIOVDbSvc *iovDB = dynamic_cast<IIOVDbSvc*>(proxy->provider());
375 if (iovDB != nullptr) {
376 ATH_MSG_DEBUG("Dropping " << key << "via IOVDBSvc");
377 ATH_CHECK( iovDB->dropObject(key, /*resetCache=*/true) );
378 } else {
379 ATH_MSG_ERROR("dropObjectFromDB: Provider for " << key << " is not an IIOVDbSvc.");
380 return StatusCode::FAILURE;
381 }
382
383 return StatusCode::SUCCESS;
384}
#define ATH_CHECK
Evaluate an expression and check for errors.
virtual bool dropObject(const std::string &key, const bool resetCache=false)=0
virtual StatusCode setRange(const CLID &clid, const std::string &key, IOVRange &)=0

◆ fullProxyName() [1/2]

std::string IOVSvc::fullProxyName ( const CLID & clid,
const std::string & key ) const
private

Definition at line 602 of file IOVSvc.cxx.

602 {
603
604 std::string fullname, tname;
605 if (p_CLIDSvc->getTypeNameOfID( clid, tname ).isFailure()) {
606 fullname = "[";
607 fullname += std::to_string(clid);
608 fullname += '/';
609 fullname += key;
610 fullname += ']';
611 } else {
612 fullname = "[";
613 fullname += tname;
614 fullname += ':';
615 fullname += std::to_string(clid);
616 fullname += '/';
617 fullname += key;
618 fullname += ']';
619 }
620
621 return fullname;
622}

◆ fullProxyName() [2/2]

std::string IOVSvc::fullProxyName ( const SG::DataProxy * proxy) const
private

Definition at line 593 of file IOVSvc.cxx.

593 {
594
595 return fullProxyName(dp->clID(), dp->name());
596
597}

◆ getRange()

StatusCode IOVSvc::getRange ( const CLID & clid,
const std::string & key,
IOVRange & io ) const
overridevirtual

Definition at line 390 of file IOVSvc.cxx.

391 {
392
393 IIOVSvcTool *ist = getTool( clid, key );
394 if (ist == nullptr) {
395 ATH_MSG_ERROR( "getRange: proxy for " << fullProxyName(clid,key)
396 << " not registered" );
397 return StatusCode::FAILURE;
398 } else {
399 return ist->getRange( clid, key, iov );
400 }
401
402}
virtual StatusCode getRange(const CLID &clid, const std::string &key, IOVRange &iov) const =0

◆ getRangeFromDB() [1/2]

StatusCode IOVSvc::getRangeFromDB ( const CLID & clid,
const std::string & key,
const IOVTime & time,
IOVRange & range,
std::string & tag,
std::unique_ptr< IOpaqueAddress > & ioa ) const
overridevirtual

Get IOVRange from db for a particular event.

Definition at line 437 of file IOVSvc.cxx.

440 {
441
442 std::scoped_lock lock(m_lock);
443
444 IIOVSvcTool *ist = getTool( clid, key );
445 if (ist == nullptr) {
446 ATH_MSG_ERROR( "getRangeFromDB: proxy for "
447 << fullProxyName(clid, key) << " not registered" );
448 return StatusCode::FAILURE;
449 } else {
450 return ist->getRangeFromDB( clid, key, time, range, tag, ioa );
451 }
452
453}
virtual StatusCode getRangeFromDB(const CLID &clid, const std::string &key, IOVRange &range, std::string &tag, std::unique_ptr< IOpaqueAddress > &ioa, const IOVTime &curTime) const =0

◆ getRangeFromDB() [2/2]

StatusCode IOVSvc::getRangeFromDB ( const CLID & clid,
const std::string & key,
IOVRange & range,
std::string & tag,
std::unique_ptr< IOpaqueAddress > & ioa,
const EventIDBase & now ) const
overridevirtual

Get IOVRange from db for current event.

Definition at line 407 of file IOVSvc.cxx.

410 {
411
412 std::scoped_lock lock(m_lock);
413
414 IIOVSvcTool *ist = getTool( clid, key );
415 if (ist == nullptr) {
416 ATH_MSG_ERROR( "getRangeFromDB: proxy for "
417 << fullProxyName(clid,key) << " not registered" );
418 return StatusCode::FAILURE;
419 } else {
420
421 uint32_t event = now.lumi_block();
422 uint32_t run = now.run_number();
423 IOVTime curTime;
424 curTime.setRunEvent(run,event);
425 // get ns timestamp from event
426 curTime.setTimestamp(1000000000L*static_cast<uint64_t>(now.time_stamp()) + now.time_stamp_ns_offset());
427
428
429 return ist->getRangeFromDB( clid, key, range, tag, ioa, curTime );
430 }
431
432}
void setRunEvent(uint32_t run, uint32_t event) noexcept
Definition IOVTime.cxx:96
void setTimestamp(uint64_t timestamp) noexcept
Definition IOVTime.cxx:72
setEventNumber uint32_t
int run(int argc, char *argv[])

◆ getStoreNames()

std::vector< std::string > IOVSvc::getStoreNames ( ) const
overridevirtual

Definition at line 627 of file IOVSvc.cxx.

627 {
628
629 auto keys = m_toolMap | std::views::keys;
630 return std::vector<std::string>(keys.begin(), keys.end());
631
632}

◆ getTool() [1/3]

IIOVSvcTool * IOVSvc::getTool ( const CLID & clid,
const std::string & key ) const
private

Definition at line 578 of file IOVSvc.cxx.

578 {
579
580 for (const auto& [name, ist] : m_toolMap) {
581 if (ist->holdsProxy( clid, key )) {
582 return ist;
583 }
584 }
585
586 return nullptr;
587
588}

◆ getTool() [2/3]

IIOVSvcTool * IOVSvc::getTool ( const std::string & storeName,
bool createIF = true )
private

Definition at line 539 of file IOVSvc.cxx.

539 {
540
541 const std::string store = (storeName=="default" ? defaultStore : storeName);
542
543 const auto itr = m_toolMap.find( store );
544 IIOVSvcTool *ist = nullptr;
545 if ( itr == m_toolMap.end() ) {
546 ATH_MSG_INFO( "No IOVSvcTool associated with store \"" << store
547 << "\"" );
548
549 if (createIF) {
550 createIOVTool(store, ist).ignore();
551 }
552
553 } else {
554 ist = itr->second;
555 }
556
557 return ist;
558}

◆ getTool() [3/3]

IIOVSvcTool * IOVSvc::getTool ( SG::DataProxy * proxy) const
private

Definition at line 563 of file IOVSvc.cxx.

563 {
564
565 for (const auto& [name, ist] : m_toolMap) {
566 if (ist->holdsProxy( proxy )) {
567 return ist;
568 }
569 }
570
571 return nullptr;
572
573}

◆ ignoreProxy()

void IOVSvc::ignoreProxy ( const CLID & clid,
const std::string & key,
const std::string & storeName )
overridevirtual

ignore proxy

Definition at line 210 of file IOVSvc.cxx.

211 {
212
213 IIOVSvcTool *ist = getTool( storeName );
214 if (ist == nullptr) {
215 ATH_MSG_ERROR( "ignoreProxy: no IOVSvcTool found for store "
216 << storeName << " and failed to create one" );
217 return;
218 }
219
220 return ist->ignoreProxy( clid, key );
221}
virtual void ignoreProxy(SG::DataProxy *proxy)=0

◆ initialize()

StatusCode IOVSvc::initialize ( )
overridevirtual

Definition at line 77 of file IOVSvc.cxx.

77 {
78
79 msg().setLevel( m_outputLevel.value() );
80 ATH_MSG_DEBUG( "Initializing IOVSvc" );
81
82 ATH_CHECK( p_sgs.retrieve() );
83 ATH_CHECK( p_detStore.retrieve() );
84 ATH_CHECK( p_condSvc.retrieve() );
85
86 return StatusCode::SUCCESS;
87}
MsgStream & msg
Definition testRead.cxx:32

◆ preLoadDataTAD()

StatusCode IOVSvc::preLoadDataTAD ( const SG::TransientAddress * tad,
const std::string & storeName )
overridevirtual

supply a list of TADs whose data will be preloaded

add to a set of TADs that who's data will be preLoaded

Definition at line 273 of file IOVSvc.cxx.

274 {
275
276 IIOVSvcTool *ist = getTool( storeName );
277 if (ist == nullptr) {
278 ATH_MSG_ERROR( "preLoadDataTAD: no IOVSvcTool associated with store \""
279 << storeName << "\" and failed to create one." );
280 return StatusCode::FAILURE;
281 } else {
282 return ist->preLoadDataTAD( tad );
283 }
284
285}
virtual StatusCode preLoadDataTAD(const SG::TransientAddress *)=0

◆ preLoadTAD()

StatusCode IOVSvc::preLoadTAD ( const SG::TransientAddress * tad,
const std::string & storeName )
overridevirtual

supply a list of TADs whose proxies will be preloaded

add to a set of TADs that will be registered at start of first event

Definition at line 252 of file IOVSvc.cxx.

253 {
254
255
256 IIOVSvcTool *ist = getTool( storeName );
257 if (ist == nullptr) {
258 ATH_MSG_ERROR( "preLoadTAD: no IOVSvcTool associated with store \""
259 << storeName << "\" and failed to create one." );
260 return StatusCode::FAILURE;
261 } else {
262 return ist->preLoadTAD( tad );
263 }
264
265}
virtual StatusCode preLoadTAD(const SG::TransientAddress *)=0

◆ regProxy() [1/2]

StatusCode IOVSvc::regProxy ( const CLID & clid,
const std::string & key,
const std::string & storeName )
overridevirtual

Another way to subscribe.

Register a DataProxy with the service.

Definition at line 132 of file IOVSvc.cxx.

133 {
134
135 std::scoped_lock lock(m_lock);
136 IIOVSvcTool *ist = getTool( storeName );
137 if (ist == nullptr) {
138 ATH_MSG_ERROR( "regProxy: no IOVSvcTool associated with store \""
139 << storeName << "\" and failed to create one." );
140 return (StatusCode::FAILURE);
141 }
142
143 IIOVSvcTool *ist2 = getTool( clid, key );
144 if (ist2 != nullptr) {
145 if (ist2 != ist) {
146 ATH_MSG_ERROR( "regProxy: when registering proxy for "
147 << fullProxyName(clid,key)
148 << " with store " << storeName
149 << ", it is already registered with store \""
150 << ist2->getStoreName() << "\"" );
151 return StatusCode::FAILURE;
152 } else {
153 ATH_MSG_DEBUG( "regProxy: proxy for " << fullProxyName(clid,key)
154 << " already registered with store \"" << storeName << "\""
155 );
156 return StatusCode::SUCCESS;
157 }
158 }
159
160 return ist->regProxy( clid, key );
161
162}
virtual StatusCode regProxy(SG::DataProxy *proxy, const std::string &key)=0
virtual const std::string & getStoreName() const =0

◆ regProxy() [2/2]

StatusCode IOVSvc::regProxy ( SG::DataProxy * proxy,
const std::string & key,
const std::string & storeName )
overridevirtual

Subscribe method for DataProxy. key StoreGate key.

Register a DataProxy with the service.

Definition at line 95 of file IOVSvc.cxx.

96 {
97
98 std::scoped_lock lock(m_lock);
99 IIOVSvcTool *ist = getTool( storeName );
100 if (ist == nullptr) {
101 ATH_MSG_ERROR( "regProxy: no IOVSvcTool associated with store \""
102 << storeName << "\" and failed to create one" );
103 return (StatusCode::FAILURE);
104 }
105
106 IIOVSvcTool *ist2 = getTool( proxy );
107 if (ist2 != nullptr) {
108 if (ist2 != ist) {
109 ATH_MSG_ERROR( "regProxy: when registering proxy for "
110 << fullProxyName(proxy) << " with store \"" << storeName
111 << "\", it is already registered with store \""
112 << ist2->getStoreName() << "\"" );
113 return StatusCode::FAILURE;
114 } else {
115 ATH_MSG_DEBUG( "regProxy: proxy for " << fullProxyName(proxy)
116 << " already registered with store \"" << storeName << "\""
117 );
118 return StatusCode::SUCCESS;
119 }
120 }
121
122 return ist->regProxy( proxy, key );
123
124}

◆ reinitialize()

StatusCode IOVSvc::reinitialize ( )
overridevirtual

Definition at line 475 of file IOVSvc.cxx.

476{
478 for (const auto& [name, ist] : m_toolMap) {
479 sc &= ist->reinitialize();
480 }
481 return sc;
482
483}

◆ replaceProxy()

StatusCode IOVSvc::replaceProxy ( SG::DataProxy * pOld,
SG::DataProxy * pNew,
const std::string & storeName )
overridevirtual

replace a registered DataProxy with a new version

Replace a registered DataProxy with a new version.

Definition at line 230 of file IOVSvc.cxx.

231 {
232
233 StatusCode sc(StatusCode::FAILURE);
234 IIOVSvcTool *ist = getTool( storeName );
235 if (ist != nullptr) {
236 sc = ist->replaceProxy(pOld, pNew);
237 } else {
238 ATH_MSG_ERROR( "regProxy: no IOVSvcTool associated with store \""
239 << storeName << "\" and failed to create one." );
240 }
241 return sc;
242}
virtual StatusCode replaceProxy(SG::DataProxy *pOld, SG::DataProxy *pNew)=0

◆ resetAllProxies()

void IOVSvc::resetAllProxies ( )
overridevirtual

Definition at line 637 of file IOVSvc.cxx.

637 {
638
639 for (auto& [name, ist] : m_toolMap) {
640 ATH_MSG_DEBUG( "resetting all proxies for store \""
641 << ist->getStoreName() << "\"" );
642 ist->resetAllProxies();
643 }
644
645}

◆ setRange() [1/2]

StatusCode IOVSvc::setRange ( const CLID & clid,
const std::string & key,
IOVRange & iovr )
overridevirtual

Update Range from dB.

Definition at line 290 of file IOVSvc.cxx.

291 {
292
293 std::scoped_lock lock(m_lock);
294
295 IIOVSvcTool *ist = getTool( clid, key );
296 if (ist == nullptr) {
297
298 // FIXME - this should be eliminated once the IOVDbSvc is set up to
299 // use store names. There should be no default store for setRange
300
301 ATH_MSG_WARNING( "setRange(CLID,key,range) for unregistered proxies "
302 << "is deprecated - you need to specify a store! "
303 << "This will be an ERROR soon!" );
304
305 return setRange(clid,key,iovr, defaultStore );
306
307 } else {
308 return ist->setRange( clid, key, iovr );
309 }
310
311}
#define ATH_MSG_WARNING(x)
virtual StatusCode setRange(const CLID &clid, const std::string &key, IOVRange &) override
Update Range from dB.
Definition IOVSvc.cxx:290

◆ setRange() [2/2]

StatusCode IOVSvc::setRange ( const CLID & clid,
const std::string & key,
IOVRange & io,
const std::string & storeName )
overridevirtual

Definition at line 316 of file IOVSvc.cxx.

317 {
318
319 std::scoped_lock lock(m_lock);
320
321 IIOVSvcTool *ist = getTool( storeName );
322 if (ist == nullptr) {
323 ATH_MSG_ERROR( "setRange: no IOVSvcTool associated with store \""
324 << storeName << "\" and failed to create one." );
325 return StatusCode::FAILURE;
326 }
327
328 IIOVSvcTool *ist2 = getTool( clid, key );
329 if (ist2 == nullptr) {
330 ATH_MSG_INFO( "setRange: proxy for " << fullProxyName(clid,key)
331 << " not registered with store \"" << storeName << "\". Doing it now"
332 );
333 if (ist->regProxy(clid, key).isFailure()) {
334 return StatusCode::FAILURE;
335 }
336 } else if (ist2 != ist) {
337 ATH_MSG_INFO( "setRange: when registering proxy (clid: "
338 << clid << " key: " << key << ") with store \"" << storeName
339 << "\" --> already registered with store \"" << ist2->getStoreName()
340 << "\"" );
341 return StatusCode::FAILURE;
342 }
343
344 return ist->setRange( clid, key, iovr );
345
346}

◆ setRangeInDB()

StatusCode IOVSvc::setRangeInDB ( const CLID & clid,
const std::string & key,
const IOVRange & range,
const std::string & tag )
overridevirtual

Set a particular IOVRange in db (and memory)

Definition at line 458 of file IOVSvc.cxx.

459 {
460
461 IIOVSvcTool *ist = getTool( clid, key );
462 if (ist == nullptr) {
463 ATH_MSG_ERROR( "setRangeInDB: proxy for "
464 << fullProxyName(clid,key) << " not registered" );
465 return StatusCode::FAILURE;
466 } else {
467 return ist->setRangeInDB( clid, key, range, tag );
468 }
469
470}
virtual StatusCode setRangeInDB(const CLID &clid, const std::string &key, const IOVRange &range, const std::string &tag)=0

Member Data Documentation

◆ m_forceReset

Gaudi::Property<bool> IOVSvc::m_forceReset {this, "forceResetAtBeginRun", false}
private

Definition at line 141 of file IOVSvc.h.

141{this, "forceResetAtBeginRun", false};

◆ m_lock

std::recursive_mutex IOVSvc::m_lock
mutableprivate

Definition at line 153 of file IOVSvc.h.

◆ m_partialPreLoadData

Gaudi::Property<bool> IOVSvc::m_partialPreLoadData {this, "partialPreloadData", true}
private

Definition at line 138 of file IOVSvc.h.

138{this, "partialPreloadData", true};

◆ m_preLoadData

Gaudi::Property<bool> IOVSvc::m_preLoadData {this, "preLoadData", false}
private

Definition at line 137 of file IOVSvc.h.

137{this, "preLoadData", false};

◆ m_preLoadExtensibleFolders

Gaudi::Property<bool> IOVSvc::m_preLoadExtensibleFolders {this, "preLoadExtensibleFolders", true}
private

Definition at line 139 of file IOVSvc.h.

139{this, "preLoadExtensibleFolders", true};

◆ m_preLoadRanges

Gaudi::Property<bool> IOVSvc::m_preLoadRanges {this, "preLoadRanges", false}
private

Definition at line 136 of file IOVSvc.h.

136{this, "preLoadRanges", false};

◆ m_sortKeys

Gaudi::Property<bool> IOVSvc::m_sortKeys {this, "sortKeys", true}
private

Definition at line 140 of file IOVSvc.h.

140{this, "sortKeys", true};

◆ m_toolMap

std::map< std::string, IIOVSvcTool* > IOVSvc::m_toolMap
private

Definition at line 149 of file IOVSvc.h.

◆ m_updateInterval

Gaudi::Property<std::string> IOVSvc::m_updateInterval {this, "updateInterval", "Event"}
private

Definition at line 142 of file IOVSvc.h.

142{this, "updateInterval", "Event"};

◆ p_CLIDSvc

ServiceHandle<IClassIDSvc> IOVSvc::p_CLIDSvc
private

Definition at line 145 of file IOVSvc.h.

◆ p_condSvc

ServiceHandle<ICondSvc> IOVSvc::p_condSvc
private

Definition at line 147 of file IOVSvc.h.

◆ p_detStore

ServiceHandle<StoreGateSvc> IOVSvc::p_detStore
private

Definition at line 146 of file IOVSvc.h.

◆ p_sgs

ServiceHandle<StoreGateSvc> IOVSvc::p_sgs
private

Definition at line 146 of file IOVSvc.h.

◆ p_toolSvc

ServiceHandle<IToolSvc> IOVSvc::p_toolSvc
private

Definition at line 144 of file IOVSvc.h.


The documentation for this class was generated from the following files: