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::ESSourceDataProxyTemplate< DataT > DataProxy< RecordT, DataT, Initializer >

Public Member Functions

 ESSourceDataProxyBase (edm::SerialTaskQueue *iQueue, std::mutex *iMutex)
 
std::mutex * mutex () const
 
edm::SerialTaskQueuequeue () const
 
- 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
 
- Protected Member Functions inherited from edm::eventsetup::DataProxy
void clearCacheIsValid ()
 
virtual void const * getAfterPrefetchImpl () const =0
 

Private Member Functions

void prefetchAsyncImpl (edm::WaitingTaskHolder iTask, edm::eventsetup::EventSetupRecordImpl const &, edm::eventsetup::DataKey const &iKey, edm::EventSetupImpl const *, edm::ServiceToken const &, edm::ESParentContext const &) final
 

Private Attributes

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

Detailed Description

Definition at line 39 of file ESSourceDataProxyBase.h.

Constructor & Destructor Documentation

◆ ESSourceDataProxyBase()

edm::eventsetup::ESSourceDataProxyBase::ESSourceDataProxyBase ( edm::SerialTaskQueue iQueue,
std::mutex iMutex 
)
inline

Definition at line 41 of file ESSourceDataProxyBase.h.

42  : m_queue(iQueue), m_mutex(iMutex), m_prefetching{false} {}

Member Function Documentation

◆ 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 48 of file ESSourceDataProxyBase.h.

48  {
50  m_prefetching = false;
51  }

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

◆ 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 52 of file ESSourceDataProxyBase.h.

52 {}

◆ mutex()

std::mutex* edm::eventsetup::ESSourceDataProxyBase::mutex ( ) const
inline

Definition at line 45 of file ESSourceDataProxyBase.h.

45 { return m_mutex; }

References m_mutex.

◆ prefetch()

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

◆ prefetchAsyncImpl()

void ESSourceDataProxyBase::prefetchAsyncImpl ( edm::WaitingTaskHolder  ,
edm::eventsetup::EventSetupRecordImpl const &  ,
edm::eventsetup::DataKey const &  iKey,
edm::EventSetupImpl const *  ,
edm::ServiceToken const &  ,
edm::ESParentContext const &   
)
finalprivatevirtual

This is the function which does the real work of getting the data if it is not already cached. The returning 'void const*' must point to an instance of the class type corresponding to the type designated in iKey. So if iKey refers to a base class interface the pointer must be a pointer to that base class interface and not a pointer to an inheriting class instance.

Implements edm::eventsetup::DataProxy.

Definition at line 25 of file ESSourceDataProxyBase.cc.

30  {
31  bool expected = false;
32  auto doPrefetch = m_prefetching.compare_exchange_strong(expected, true);
33  m_waitingList.add(iTask);
34  if (doPrefetch) {
35  m_queue->push(*iTask.group(), [this, iKey, &iRecord, iParent]() {
36  try {
37  {
38  std::lock_guard<std::mutex> guard(*m_mutex);
40  iRecord.activityRegistry()->preESModuleSignal_.emit(iRecord.key(), context);
41  struct EndGuard {
42  EndGuard(EventSetupRecordImpl const& iRecord, ESModuleCallingContext const& iContext)
43  : record_{iRecord}, context_{iContext} {}
44  ~EndGuard() { record_.activityRegistry()->postESModuleSignal_.emit(record_.key(), context_); }
45  EventSetupRecordImpl const& record_;
46  ESModuleCallingContext const& context_;
47  } guardAR(iRecord, context);
48  prefetch(iKey, EventSetupRecordDetails(&iRecord));
49  }
50  m_waitingList.doneWaiting(std::exception_ptr{});
51  } catch (...) {
52  m_waitingList.doneWaiting(std::current_exception());
53  }
54  });
55  }
56 }

References edm::WaitingTaskList::add(), visDQMUpload::context, edm::WaitingTaskList::doneWaiting(), edm::WaitingTaskHolder::group(), edm::ESModuleCallingContext::kRunning, m_mutex, m_prefetching, m_queue, m_waitingList, prefetch(), edm::eventsetup::DataProxy::providerDescription(), and edm::SerialTaskQueue::push().

◆ queue()

edm::SerialTaskQueue* edm::eventsetup::ESSourceDataProxyBase::queue ( ) const
inline

Definition at line 44 of file ESSourceDataProxyBase.h.

44 { return m_queue; }

References m_queue.

Member Data Documentation

◆ m_mutex

std::mutex* edm::eventsetup::ESSourceDataProxyBase::m_mutex
private

Definition at line 68 of file ESSourceDataProxyBase.h.

Referenced by mutex(), and prefetchAsyncImpl().

◆ m_prefetching

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

Definition at line 69 of file ESSourceDataProxyBase.h.

Referenced by invalidateCache(), and prefetchAsyncImpl().

◆ m_queue

edm::SerialTaskQueue* edm::eventsetup::ESSourceDataProxyBase::m_queue
private

Definition at line 67 of file ESSourceDataProxyBase.h.

Referenced by prefetchAsyncImpl(), and queue().

◆ m_waitingList

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

Definition at line 66 of file ESSourceDataProxyBase.h.

Referenced by invalidateCache(), and prefetchAsyncImpl().

edm::ESModuleCallingContext
Definition: ESModuleCallingContext.h:27
edm::eventsetup::ESSourceDataProxyBase::m_mutex
std::mutex * m_mutex
Definition: ESSourceDataProxyBase.h:68
edm::SerialTaskQueue::push
void push(tbb::task_group &, const T &iAction)
asynchronously pushes functor iAction into queue
Definition: SerialTaskQueue.h:167
EventSetupRecordDetails
edm::WaitingTaskList::reset
void reset()
Resets access to the resource so that added tasks will wait.
Definition: WaitingTaskList.cc:53
visDQMUpload.context
context
Definition: visDQMUpload.py:37
edm::eventsetup::ESSourceDataProxyBase::m_queue
edm::SerialTaskQueue * m_queue
Definition: ESSourceDataProxyBase.h:67
edm::WaitingTaskList::doneWaiting
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
Definition: WaitingTaskList.cc:212
edm::eventsetup::DataProxy::providerDescription
ComponentDescription const * providerDescription() const
returns the description of the DataProxyProvider which owns this Proxy
Definition: DataProxy.h:68
edm::WaitingTaskList::add
void add(tbb::task_group *, WaitingTask *)
Adds task to the waiting list.
Definition: WaitingTaskList.cc:125
edm::eventsetup::ESSourceDataProxyBase::m_waitingList
edm::WaitingTaskList m_waitingList
Definition: ESSourceDataProxyBase.h:66
edm::eventsetup::ESSourceDataProxyBase::prefetch
virtual void prefetch(edm::eventsetup::DataKey const &iKey, EventSetupRecordDetails)=0
edm::ESModuleCallingContext::State::kRunning
edm::eventsetup::ESSourceDataProxyBase::m_prefetching
std::atomic< bool > m_prefetching
Definition: ESSourceDataProxyBase.h:69