CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
edm::eventsetup::ESSourceDataProxyBase Class Referenceabstract

#include <ESSourceDataProxyBase.h>

Inheritance diagram for edm::eventsetup::ESSourceDataProxyBase:
edm::eventsetup::DataProxy edm::eventsetup::ESSourceDataProxyConcurrentBase edm::eventsetup::ESSourceDataProxyNonConcurrentBase edm::eventsetup::ESSourceConcurrentDataProxyTemplate< DataT > edmtest::TestESConcurrentSourceTestProxy edm::eventsetup::ESSourceDataProxyTemplate< DataT > edmtest::TestESSourceTestProxy DataProxy< RecordT, DataT, Initializer >

Public Member Functions

 ESSourceDataProxyBase ()
 
- Public Member Functions inherited from edm::eventsetup::DataProxy
bool cacheIsValid () const
 
 DataProxy ()
 
 DataProxy (DataProxy const &)=delete
 
void const * get (EventSetupRecordImpl const &, DataKey const &, bool iTransiently, ActivityRegistry const *, EventSetupImpl const *, ESParentContext const &) const
 
void const * getAfterPrefetch (const EventSetupRecordImpl &iRecord, const DataKey &iKey, bool iTransiently) const
 
virtual void initializeForNewIOV ()
 
void invalidate ()
 
DataProxy const & operator= (DataProxy const &)=delete
 
void prefetchAsync (WaitingTaskHolder, EventSetupRecordImpl const &, DataKey const &, EventSetupImpl const *, ServiceToken const &, ESParentContext const &) const
 
ComponentDescription const * providerDescription () const
 returns the description of the DataProxyProvider which owns this Proxy More...
 
void resetIfTransient ()
 
void setProviderDescription (ComponentDescription const *iDesc)
 
virtual ~DataProxy ()
 

Protected Member Functions

void invalidateCache () override
 
void invalidateTransientCache () override
 
virtual void prefetch (edm::eventsetup::DataKey const &iKey, EventSetupRecordDetails)=0
 
template<typename ASYNC , typename GUARD >
void prefetchAsyncImplTemplate (ASYNC iAsync, GUARD iGuardFactory, edm::WaitingTaskHolder iTask, edm::eventsetup::EventSetupRecordImpl const &iRecord, edm::eventsetup::DataKey const &iKey, edm::ESParentContext const &iContext)
 
- Protected Member Functions inherited from edm::eventsetup::DataProxy
void clearCacheIsValid ()
 
virtual void const * getAfterPrefetchImpl () const =0
 
virtual void prefetchAsyncImpl (WaitingTaskHolder, EventSetupRecordImpl const &, DataKey const &iKey, EventSetupImpl const *, ServiceToken const &, ESParentContext const &)=0
 

Private Member Functions

void doPrefetchAndSignals (edm::eventsetup::EventSetupRecordImpl const &, edm::eventsetup::DataKey const &iKey, edm::ESParentContext const &)
 
template<typename GUARD >
void guardPrefetch (GUARD iGuardFactory, edm::eventsetup::EventSetupRecordImpl const &iES, edm::eventsetup::DataKey const &iKey, edm::ESParentContext const &iContext)
 
bool needToPrefetch (edm::WaitingTaskHolder iTask)
 

Private Attributes

std::atomic< bool > m_prefetching
 
edm::WaitingTaskList m_waitingList
 

Detailed Description

Definition at line 35 of file ESSourceDataProxyBase.h.

Constructor & Destructor Documentation

◆ ESSourceDataProxyBase()

edm::eventsetup::ESSourceDataProxyBase::ESSourceDataProxyBase ( )
inline

Definition at line 37 of file ESSourceDataProxyBase.h.

37 : m_prefetching{false} {}

Member Function Documentation

◆ doPrefetchAndSignals()

void ESSourceDataProxyBase::doPrefetchAndSignals ( edm::eventsetup::EventSetupRecordImpl const &  iRecord,
edm::eventsetup::DataKey const &  iKey,
edm::ESParentContext const &  iParent 
)
private

Definition at line 31 of file ESSourceDataProxyBase.cc.

References edm::eventsetup::EventSetupRecordImpl::activityRegistry(), visDQMUpload::context, edm::signalslot::Signal< T >::emit(), edm::eventsetup::EventSetupRecordImpl::key(), edm::ESModuleCallingContext::kRunning, edm::ActivityRegistry::preESModuleSignal_, and nano_postproc::prefetch.

Referenced by guardPrefetch().

33  {
35  iRecord.activityRegistry()->preESModuleSignal_.emit(iRecord.key(), context);
36  struct EndGuard {
37  EndGuard(EventSetupRecordImpl const& iRecord, ESModuleCallingContext const& iContext)
38  : record_{iRecord}, context_{iContext} {}
39  ~EndGuard() { record_.activityRegistry()->postESModuleSignal_.emit(record_.key(), context_); }
40  EventSetupRecordImpl const& record_;
41  ESModuleCallingContext const& context_;
42  } guardAR(iRecord, context);
43  prefetch(iKey, EventSetupRecordDetails(&iRecord));
44 }
ComponentDescription const * providerDescription() const
returns the description of the DataProxyProvider which owns this Proxy
Definition: DataProxy.h:68
virtual void prefetch(edm::eventsetup::DataKey const &iKey, EventSetupRecordDetails)=0

◆ guardPrefetch()

template<typename GUARD >
void edm::eventsetup::ESSourceDataProxyBase::guardPrefetch ( GUARD  iGuardFactory,
edm::eventsetup::EventSetupRecordImpl const &  iES,
edm::eventsetup::DataKey const &  iKey,
edm::ESParentContext const &  iContext 
)
inlineprivate

Definition at line 71 of file ESSourceDataProxyBase.h.

References doPrefetchAndSignals().

Referenced by prefetchAsyncImplTemplate().

74  {
75  [[maybe_unused]] auto guard = iGuardFactory();
76  doPrefetchAndSignals(iES, iKey, iContext);
77  }
void doPrefetchAndSignals(edm::eventsetup::EventSetupRecordImpl const &, edm::eventsetup::DataKey const &iKey, edm::ESParentContext const &)

◆ invalidateCache()

void edm::eventsetup::ESSourceDataProxyBase::invalidateCache ( )
inlineoverrideprotectedvirtual

indicates that the Proxy should invalidate any cached information as that information has 'expired' (i.e. we have moved to a new IOV)

Implements edm::eventsetup::DataProxy.

Definition at line 40 of file ESSourceDataProxyBase.h.

References m_prefetching, m_waitingList, and edm::WaitingTaskList::reset().

40  {
42  m_prefetching = false;
43  }
void reset()
Resets access to the resource so that added tasks will wait.

◆ invalidateTransientCache()

void edm::eventsetup::ESSourceDataProxyBase::invalidateTransientCache ( )
inlineoverrideprotectedvirtual

indicates that the Proxy should invalidate any cached information as that information was accessed transiently and therefore is not intended to be kept over the entire IOV. Default is to call invalidateCache().

Reimplemented from edm::eventsetup::DataProxy.

Definition at line 44 of file ESSourceDataProxyBase.h.

44 {}

◆ needToPrefetch()

bool ESSourceDataProxyBase::needToPrefetch ( edm::WaitingTaskHolder  iTask)
private

Definition at line 25 of file ESSourceDataProxyBase.cc.

References edm::WaitingTaskList::add(), m_prefetching, m_waitingList, and eostools::move().

Referenced by prefetchAsyncImplTemplate().

25  {
26  m_waitingList.add(std::move(iTask));
27  bool expected = false;
28  return m_prefetching.compare_exchange_strong(expected, true);
29 }
void add(oneapi::tbb::task_group *, WaitingTask *)
Adds task to the waiting list.
def move(src, dest)
Definition: eostools.py:511

◆ prefetch()

virtual void edm::eventsetup::ESSourceDataProxyBase::prefetch ( edm::eventsetup::DataKey const &  iKey,
EventSetupRecordDetails   
)
protectedpure virtual

◆ prefetchAsyncImplTemplate()

template<typename ASYNC , typename GUARD >
void edm::eventsetup::ESSourceDataProxyBase::prefetchAsyncImplTemplate ( ASYNC  iAsync,
GUARD  iGuardFactory,
edm::WaitingTaskHolder  iTask,
edm::eventsetup::EventSetupRecordImpl const &  iRecord,
edm::eventsetup::DataKey const &  iKey,
edm::ESParentContext const &  iContext 
)
inlineprotected

Definition at line 50 of file ESSourceDataProxyBase.h.

References edm::WaitingTaskList::doneWaiting(), edm::WaitingTaskHolder::group(), watchdog::group, guardPrefetch(), m_waitingList, eostools::move(), and needToPrefetch().

Referenced by edm::eventsetup::ESSourceDataProxyConcurrentBase::prefetchAsyncImpl(), and edm::eventsetup::ESSourceDataProxyNonConcurrentBase::prefetchAsyncImpl().

55  {
56  auto group = iTask.group();
57  if (needToPrefetch(std::move(iTask))) {
58  iAsync(*group, [this, iGuardFactory, &iRecord, iKey, iContext]() {
59  try {
60  guardPrefetch(iGuardFactory, iRecord, iKey, iContext);
61  m_waitingList.doneWaiting(std::exception_ptr{});
62  } catch (...) {
63  m_waitingList.doneWaiting(std::current_exception());
64  }
65  });
66  }
67  }
oneapi::tbb::task_group * group() const noexcept
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
bool needToPrefetch(edm::WaitingTaskHolder iTask)
void guardPrefetch(GUARD iGuardFactory, edm::eventsetup::EventSetupRecordImpl const &iES, edm::eventsetup::DataKey const &iKey, edm::ESParentContext const &iContext)
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ m_prefetching

std::atomic<bool> edm::eventsetup::ESSourceDataProxyBase::m_prefetching
private

Definition at line 88 of file ESSourceDataProxyBase.h.

Referenced by invalidateCache(), and needToPrefetch().

◆ m_waitingList

edm::WaitingTaskList edm::eventsetup::ESSourceDataProxyBase::m_waitingList
private