The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
EvtStoreSvc Class Reference

Use a minimal event store implementation, and adds everything required to satisfy the IDataProviderSvc, IDataManagerSvc and IHiveWhiteBoard interfaces by throwing exceptions except when the functionality is really needed... More...

Inheritance diagram for EvtStoreSvc:
Collaboration diagram for EvtStoreSvc:

Public Member Functions

CLID rootCLID () const override
const std::string & rootName () const override
StatusCode setDataLoader (IConversionSvc *svc, IDataProviderSvc *dpsvc) override
size_t allocateStore (int evtnumber) override
 Allocate a store partition for a given event number.
StatusCode freeStore (size_t partition) override
 Free a store partition.
size_t freeSlots () override
StatusCode selectStore (size_t partition) override
 Activate a partition object. The identifies the partition uniquely.
StatusCode clearStore () override
StatusCode clearStore (size_t partition) override
 Remove all data objects in one 'slot' of the data store.
StatusCode setNumberOfStores (size_t slots) override
 Set the number of event slots (copies of DataSvc objects).
size_t getNumberOfStores () const override
size_t getPartitionNumber (int eventnumber) const override
 Get the partition number corresponding to a given event.
bool exists (const DataObjID &id) override
StatusCode objectParent (const DataObject *, IRegistry *&) override
StatusCode objectParent (const IRegistry *, IRegistry *&) override
StatusCode objectLeaves (const DataObject *, std::vector< IRegistry * > &) override
StatusCode objectLeaves (const IRegistry *, std::vector< IRegistry * > &) override
StatusCode clearSubTree (std::string_view) override
StatusCode clearSubTree (DataObject *obj) override
StatusCode traverseSubTree (std::string_view, IDataStoreAgent *) override
StatusCode traverseSubTree (DataObject *obj, IDataStoreAgent *pAgent) override
StatusCode traverseTree (IDataStoreAgent *pAgent) override
StatusCode setRoot (std::string root_name, DataObject *pObject) override
StatusCode setRoot (std::string root_path, IOpaqueAddress *pRootAddr) override
StatusCode unregisterAddress (std::string_view) override
StatusCode unregisterAddress (IRegistry *, std::string_view) override
StatusCode registerAddress (std::string_view fullPath, IOpaqueAddress *pAddress) override
StatusCode registerAddress (IRegistry *parentObj, std::string_view objectPath, IOpaqueAddress *pAddress) override
StatusCode registerObject (std::string_view parentPath, std::string_view objectPath, DataObject *pObject) override
StatusCode registerObject (DataObject *parentObj, std::string_view objectPath, DataObject *pObject) override
StatusCode unregisterObject (std::string_view) override
StatusCode unregisterObject (DataObject *obj) override
StatusCode unregisterObject (DataObject *obj, std::string_view sr) override
StatusCode retrieveObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
StatusCode findObject (IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
StatusCode findObject (std::string_view fullPath, DataObject *&pObject) override
StatusCode updateObject (IRegistry *) override
StatusCode updateObject (DataObject *) override
StatusCode addPreLoadItem (const DataStoreItem &) override
StatusCode removePreLoadItem (const DataStoreItem &) override
StatusCode resetPreLoad () override
StatusCode preLoad () override
StatusCode linkObject (IRegistry *, std::string_view, DataObject *) override
StatusCode linkObject (std::string_view, DataObject *) override
StatusCode unlinkObject (IRegistry *, std::string_view) override
StatusCode unlinkObject (DataObject *, std::string_view) override
StatusCode unlinkObject (std::string_view) override
StatusCode initialize () override
StatusCode finalize () override
Public Member Functions inherited from extends< Service, IDataProviderSvc, IDataManagerSvc, IHiveWhiteBoard, Gaudi::Concurrency::ConcurrencyManager >
void const * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast.
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface.
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames.
Public Member Functions inherited from Service
const std::string & name () const override
 Retrieve name of the service.
StatusCode configure () override
StatusCode initialize () override
StatusCode start () override
StatusCode stop () override
StatusCode finalize () override
StatusCode terminate () override
Gaudi::StateMachine::State FSMState () const override
Gaudi::StateMachine::State targetFSMState () const override
StatusCode reinitialize () override
StatusCode restart () override
StatusCode sysInitialize () override
 Initialize Service.
StatusCode sysStart () override
 Initialize Service.
StatusCode sysStop () override
 Initialize Service.
StatusCode sysFinalize () override
 Finalize Service.
StatusCode sysReinitialize () override
 Re-initialize the Service.
StatusCode sysRestart () override
 Re-initialize the Service.
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor.
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator.
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
template<class T>
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
template<class T>
StatusCode declareTool (ToolHandle< T > &handle, const std::string &toolTypeAndName, bool createIf=true)
 Declare used tool.
template<class T>
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
template<class T>
void addToolsArray (ToolHandleArray< T > &hndlArr)
const std::vector< IAlgTool * > & tools () const
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property.
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals.
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string.
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 PropertyHolder ()=default
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property.
Gaudi::Details::PropertyBase * declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property.
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name.
Gaudi::Details::PropertyBase * property (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
PropertyHolder & operator= (const PropertyHolder &)=delete
Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor.
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
MsgStream & msgStream () const
 Return an uninitialized MsgStream.
MsgStream & msgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
MsgStream & always () const
 shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & fatal () const
 shortcut for the method msgStream(MSG::FATAL)
MsgStream & err () const
 shortcut for the method msgStream(MSG::ERROR)
MsgStream & error () const
 shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning () const
 shortcut for the method msgStream(MSG::WARNING)
MsgStream & info () const
 shortcut for the method msgStream(MSG::INFO)
MsgStream & debug () const
 shortcut for the method msgStream(MSG::DEBUG)
MsgStream & verbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & msg () const
 shortcut for the method msgStream(MSG::INFO)
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream)
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream

Private Member Functions

std::size_t poolSize () const
void fillStats (Partition &p) const
void initStore (Partition &p) const

Private Attributes

Gaudi::Property< CLID > m_rootCLID { this, "RootCLID", 110 , "CLID of root entry" }
Gaudi::Property< std::string > m_rootName { this, "RootName", "/Event", "name of root entry" }
Gaudi::Property< bool > m_forceLeaves
Gaudi::Property< std::string > m_loader { this, "DataLoader", "EventPersistencySvc" }
Gaudi::Property< size_t > m_slots { this, "EventSlots", 1, "number of event slots" }
Gaudi::Property< bool > m_printPoolStats { this, "PrintPoolStats", false, "Print memory pool statistics" }
Gaudi::Property< std::size_t > m_poolSize { this, "PoolSize", 1024, "Initial per-event memory pool size [KiB]" }
Gaudi::Property< std::size_t > m_estStoreBuckets
Gaudi::Accumulators::AveragingCounter< std::size_t > m_usedPoolSize
Gaudi::Accumulators::AveragingCounter< std::size_t > m_servedPoolAllocations
Gaudi::Accumulators::AveragingCounter< std::size_t > m_usedPoolAllocations
Gaudi::Accumulators::AveragingCounter< std::size_t > m_storeEntries
Gaudi::Accumulators::AveragingCounter< std::size_t > m_storeBuckets
SmartIF< IConversionSvc > m_dataLoader
std::vector< DataStoreItem > m_preLoads
 Items to be pre-loaded.
std::vector< SynchronizedPartition > m_partitions
 The actual store(s).
tbb::concurrent_queue< size_t > m_freeSlots
Gaudi::Property< std::vector< std::string > > m_inhibitPrefixes
Gaudi::Property< bool > m_followLinksToAncestors

Additional Inherited Members

Public Types inherited from extends< Service, IDataProviderSvc, IDataManagerSvc, IHiveWhiteBoard, Gaudi::Concurrency::ConcurrencyManager >
using base_class
 Typedef to this class.
using extend_interfaces_base
 Typedef to the base of this class.
Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory<IService*( const std::string&, ISvcLocator* )>
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl
 Typedef used to refer to this class from derived classes, as in.
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class
Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids
 take union of the ext_iids of all Interfaces...
Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 ~Service () override
int outputLevel () const
 get the Service's output level
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const override final
 Set up local caches.
MSG::Level resetMessaging ()
 Reinitialize internal states.
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream.
Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state.
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state.
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools
Gaudi::Property< bool > m_auditorInitialize { this, "AuditInitialize", false, "trigger auditor on initialize()" }
Gaudi::Property< bool > m_auditorStart { this, "AuditStart", false, "trigger auditor on start()" }
Gaudi::Property< bool > m_auditorStop { this, "AuditStop", false, "trigger auditor on stop()" }
Gaudi::Property< bool > m_auditorFinalize { this, "AuditFinalize", false, "trigger auditor on finalize()" }
Gaudi::Property< bool > m_auditorReinitialize { this, "AuditReinitialize", false, "trigger auditor on reinitialize()" }
Gaudi::Property< bool > m_auditorRestart { this, "AuditRestart", false, "trigger auditor on restart()" }
Gaudi::Property< bool > m_autoRetrieveTools
Gaudi::Property< bool > m_checkToolDeps
SmartIF< IAuditorSvc > m_pAuditorSvc
 Auditor Service.

Detailed Description

Use a minimal event store implementation, and adds everything required to satisfy the IDataProviderSvc, IDataManagerSvc and IHiveWhiteBoard interfaces by throwing exceptions except when the functionality is really needed...

Author
Gerhard Raven
Version
1.0

Definition at line 214 of file EvtStoreSvc.cpp.

Member Function Documentation

◆ addPreLoadItem()

StatusCode EvtStoreSvc::addPreLoadItem ( const DataStoreItem & item)
override

Definition at line 642 of file EvtStoreSvc.cpp.

642 {
643 auto i = std::find( m_preLoads.begin(), m_preLoads.end(), item );
644 if ( i == m_preLoads.end() ) m_preLoads.push_back( item );
645 return StatusCode::SUCCESS;
646}
std::vector< DataStoreItem > m_preLoads
Items to be pre-loaded.
constexpr static const auto SUCCESS
Definition StatusCode.h:99

◆ allocateStore()

size_t EvtStoreSvc::allocateStore ( int evtnumber)
override

Allocate a store partition for a given event number.

Definition at line 399 of file EvtStoreSvc.cpp.

399 {
400 // take next free slot in the list
401 size_t slot = std::string::npos;
402 if ( m_freeSlots.try_pop( slot ) ) {
403 assert( slot != std::string::npos );
404 assert( slot < m_partitions.size() );
405 [[maybe_unused]] auto prev = m_partitions[slot].with_lock(
406 [evtnumber]( Partition& p ) { return std::exchange( p.eventNumber, evtnumber ); } );
407 assert( prev == -1 ); // or whatever value represents 'free'
408 }
409 return slot;
410}
std::vector< SynchronizedPartition > m_partitions
The actual store(s).
tbb::concurrent_queue< size_t > m_freeSlots

◆ clearStore() [1/2]

StatusCode EvtStoreSvc::clearStore ( )
override

Definition at line 461 of file EvtStoreSvc.cpp.

461 {
462 return fwd( [this]( Partition& p ) {
463 p.onlyThisID = {};
464 fillStats( p );
465 initStore( p ); // replace with a clean store
466 return StatusCode::SUCCESS;
467 } );
468}
void fillStats(Partition &p) const
void initStore(Partition &p) const

◆ clearStore() [2/2]

StatusCode EvtStoreSvc::clearStore ( size_t partition)
override

Remove all data objects in one 'slot' of the data store.

Definition at line 446 of file EvtStoreSvc.cpp.

446 {
447 return m_partitions[partition].with_lock( [this]( Partition& p ) {
448 p.onlyThisID = {};
449 fillStats( p );
450 initStore( p ); // replace with a clean store
451 return StatusCode::SUCCESS;
452 } );
453}

◆ clearSubTree() [1/2]

StatusCode EvtStoreSvc::clearSubTree ( DataObject * obj)
inlineoverride

Definition at line 300 of file EvtStoreSvc.cpp.

300 {
301 return obj && obj->registry() ? clearSubTree( obj->registry()->identifier() ) : StatusCode::FAILURE;
302 }
IRegistry * registry() const
Get pointer to Registry.
Definition DataObject.h:79
StatusCode clearSubTree(std::string_view) override
virtual const id_type & identifier() const =0
Full identifier (or key).

◆ clearSubTree() [2/2]

StatusCode EvtStoreSvc::clearSubTree ( std::string_view top)
override

Definition at line 454 of file EvtStoreSvc.cpp.

454 {
455 top = normalize_path( top, rootName() );
456 return fwd( [&]( Partition& p ) {
457 p.store->erase_if( [top]( const auto& value ) { return value.first.starts_with( top ); } );
458 return StatusCode::SUCCESS;
459 } );
460}
const std::string & rootName() const override

◆ exists()

bool EvtStoreSvc::exists ( const DataObjID & id)
inlineoverride

Definition at line 288 of file EvtStoreSvc.cpp.

288 {
289 DataObject* pObject{ nullptr };
290 return findObject( id.fullKey(), pObject ).isSuccess();
291 }
StatusCode findObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override
bool isSuccess() const
Definition StatusCode.h:302

◆ fillStats()

void EvtStoreSvc::fillStats ( Partition & p) const
inlineprivate

Definition at line 232 of file EvtStoreSvc.cpp.

232 {
233 if ( !m_printPoolStats ) return;
234 auto n_allocs = p.store->num_allocations();
235 if ( n_allocs ) {
236 m_storeEntries += p.store->size();
237 m_usedPoolSize += p.store->used_bytes();
238 m_storeBuckets += p.store->used_buckets();
239 m_usedPoolAllocations += p.store->used_blocks();
240 m_servedPoolAllocations += n_allocs;
241 }
242 }
Gaudi::Accumulators::AveragingCounter< std::size_t > m_usedPoolAllocations
Gaudi::Accumulators::AveragingCounter< std::size_t > m_storeBuckets
Gaudi::Accumulators::AveragingCounter< std::size_t > m_servedPoolAllocations
Gaudi::Property< bool > m_printPoolStats
Gaudi::Accumulators::AveragingCounter< std::size_t > m_usedPoolSize
Gaudi::Accumulators::AveragingCounter< std::size_t > m_storeEntries

◆ finalize()

StatusCode EvtStoreSvc::finalize ( )
inlineoverride

Definition at line 375 of file EvtStoreSvc.cpp.

375 {
376 if ( m_printPoolStats ) {
377 info() << "Mean memory pool usage: " << float( 1e-3f * float( m_usedPoolSize.mean() ) ) << " KiB serving "
378 << float( m_servedPoolAllocations.mean() ) << " allocations from " << float( m_usedPoolAllocations.mean() )
379 << " to produce " << float( m_storeEntries.mean() ) << " entries in " << float( m_storeBuckets.mean() )
380 << " buckets" << endmsg;
381 }
382 setDataLoader( nullptr, nullptr ).ignore(); // release
383 return extends::finalize();
384 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
StatusCode setDataLoader(IConversionSvc *svc, IDataProviderSvc *dpsvc) override
void ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:128

◆ findObject() [1/2]

StatusCode EvtStoreSvc::findObject ( IRegistry * pDirectory,
std::string_view path,
DataObject *& pObject )
override

Definition at line 632 of file EvtStoreSvc.cpp.

632 {
633 return retrieveObject( pDirectory, path, pObject );
634}
StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject) override

◆ findObject() [2/2]

StatusCode EvtStoreSvc::findObject ( std::string_view fullPath,
DataObject *& pObject )
override

Definition at line 635 of file EvtStoreSvc.cpp.

635 {
636 return retrieveObject( nullptr, fullPath, pObject );
637}

◆ freeSlots()

size_t EvtStoreSvc::freeSlots ( )
inlineoverride

Definition at line 281 of file EvtStoreSvc.cpp.

281{ return m_freeSlots.unsafe_size(); }

◆ freeStore()

StatusCode EvtStoreSvc::freeStore ( size_t partition)
override

Free a store partition.

Definition at line 438 of file EvtStoreSvc.cpp.

438 {
439 assert( partition < m_partitions.size() );
440 auto prev = m_partitions[partition].with_lock( []( Partition& p ) { return std::exchange( p.eventNumber, -1 ); } );
441 if ( prev == -1 ) return StatusCode::FAILURE; // double free -- should never happen!
442 m_freeSlots.push( partition );
443 return StatusCode::SUCCESS;
444}
constexpr static const auto FAILURE
Definition StatusCode.h:100

◆ getNumberOfStores()

size_t EvtStoreSvc::getNumberOfStores ( ) const
inlineoverride

Definition at line 286 of file EvtStoreSvc.cpp.

286{ return m_slots; }
Gaudi::Property< size_t > m_slots

◆ getPartitionNumber()

size_t EvtStoreSvc::getPartitionNumber ( int eventnumber) const
override

Get the partition number corresponding to a given event.

Definition at line 426 of file EvtStoreSvc.cpp.

426 {
427 auto i = std::find_if(
429 Gaudi::cxx::with_lock( [eventnumber]( const Partition& p ) { return p.eventNumber == eventnumber; } ) );
430 return i != end( m_partitions ) ? std::distance( begin( m_partitions ), i ) : std::string::npos;
431}
AttribStringParser::Iterator begin(const AttribStringParser &parser)
auto with_lock(Fun &&f)

◆ initialize()

StatusCode EvtStoreSvc::initialize ( )
inlineoverride

Definition at line 353 of file EvtStoreSvc.cpp.

353 {
354 Entry::setDataProviderSvc( this );
355 extends::initialize().ignore();
356 if ( !setNumberOfStores( m_slots ).isSuccess() ) {
357 error() << "Cannot set number of slots" << endmsg;
358 return StatusCode::FAILURE;
359 }
360 m_partitions = std::vector<SynchronizedPartition>( m_slots );
361 // m_partitions is now full of empty std::optionals, fill them now.
362 for ( auto& synced_p : m_partitions ) {
363 synced_p.with_lock( [this]( Partition& p ) { initStore( p ); } );
364 }
365 for ( size_t i = 0; i < m_slots; i++ ) { m_freeSlots.push( i ); }
366 selectStore( 0 ).ignore();
367
368 auto loader = serviceLocator()->service( m_loader ).as<IConversionSvc>().get();
369 if ( !loader ) {
370 error() << "Cannot get IConversionSvc " << m_loader.value() << endmsg;
371 return StatusCode::FAILURE;
372 }
373 return setDataLoader( loader, nullptr );
374 }
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode selectStore(size_t partition) override
Activate a partition object. The identifies the partition uniquely.
Gaudi::Property< std::string > m_loader
StatusCode setNumberOfStores(size_t slots) override
Set the number of event slots (copies of DataSvc objects).
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition Service.cpp:336
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition SmartIF.h:110
get
decorate the vector of properties
Definition decorators.py:94

◆ initStore()

void EvtStoreSvc::initStore ( Partition & p) const
inlineprivate

Definition at line 244 of file EvtStoreSvc.cpp.

244 {
245 if ( p.store ) {
246 // re-use the existing memory pool
247 p.store->reset();
248 } else {
249 p.store.emplace( m_estStoreBuckets, poolSize() );
250 }
251 }
std::size_t poolSize() const
Gaudi::Property< std::size_t > m_estStoreBuckets

◆ linkObject() [1/2]

StatusCode EvtStoreSvc::linkObject ( IRegistry * ,
std::string_view ,
DataObject *  )
inlineoverride

Definition at line 347 of file EvtStoreSvc.cpp.

347{ return dummy( __FUNCTION__ ); }

◆ linkObject() [2/2]

StatusCode EvtStoreSvc::linkObject ( std::string_view ,
DataObject *  )
inlineoverride

Definition at line 348 of file EvtStoreSvc.cpp.

348{ return dummy( __FUNCTION__ ); }

◆ objectLeaves() [1/2]

StatusCode EvtStoreSvc::objectLeaves ( const DataObject * ,
std::vector< IRegistry * > &  )
inlineoverride

Definition at line 296 of file EvtStoreSvc.cpp.

296{ return StatusCode::SUCCESS; }

◆ objectLeaves() [2/2]

StatusCode EvtStoreSvc::objectLeaves ( const IRegistry * ,
std::vector< IRegistry * > &  )
inlineoverride

Definition at line 297 of file EvtStoreSvc.cpp.

297{ return StatusCode::SUCCESS; }

◆ objectParent() [1/2]

StatusCode EvtStoreSvc::objectParent ( const DataObject * ,
IRegistry *&  )
inlineoverride

Definition at line 293 of file EvtStoreSvc.cpp.

293{ return dummy( __FUNCTION__ ); }

◆ objectParent() [2/2]

StatusCode EvtStoreSvc::objectParent ( const IRegistry * ,
IRegistry *&  )
inlineoverride

Definition at line 294 of file EvtStoreSvc.cpp.

294{ return dummy( __FUNCTION__ ); }

◆ poolSize()

std::size_t EvtStoreSvc::poolSize ( ) const
inlineprivate

Definition at line 230 of file EvtStoreSvc.cpp.

230{ return m_poolSize * 1024; }
Gaudi::Property< std::size_t > m_poolSize

◆ preLoad()

StatusCode EvtStoreSvc::preLoad ( )
override

Definition at line 652 of file EvtStoreSvc.cpp.

652 {
653 for ( const auto& i : m_preLoads ) {
654 DataObject* pObj;
655 if ( msgLevel( MSG::DEBUG ) ) debug() << "Preloading " << i.path() << endmsg;
656 retrieveObject( nullptr, i.path(), pObj ).ignore();
657 }
658 return StatusCode::SUCCESS;
659}
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
@ DEBUG
Definition IMessageSvc.h:22

◆ registerAddress() [1/2]

StatusCode EvtStoreSvc::registerAddress ( IRegistry * parentObj,
std::string_view objectPath,
IOpaqueAddress * pAddress )
override

Definition at line 538 of file EvtStoreSvc.cpp.

538 {
539 auto addr = std::unique_ptr<IOpaqueAddress>( pAddr );
540 if ( !addr ) return Status::INVALID_OBJ_ADDR; // Precondition: Address must be valid
541 if ( msgLevel( MSG::DEBUG ) ) {
542 debug() << "registerAddress( (IRegistry*)" << (void*)pReg << ", " << path << ", (IOpaqueAddress*)" << addr.get()
543 << "[ " << addr->par()[0] << ", " << addr->par()[1] << " ]"
544 << " )" << endmsg;
545 }
546 if ( path.empty() || path[0] != '/' ) return StatusCode::FAILURE;
547 const auto onlyThisID =
548 s_current ? s_current->with_lock( []( const Partition& p ) { return p.onlyThisID; } ) : std::string_view{};
549 if ( !onlyThisID.empty() && addr->par()[0] != onlyThisID ) {
550 if ( msgLevel( MSG::DEBUG ) )
551 debug() << "Attempt to load " << addr->par()[1] << " from file " << addr->par()[0] << " blocked -- different file"
552 << endmsg;
553 return StatusCode::SUCCESS;
554 }
555 if ( std::any_of(
557 [addrPath = addr->par()[1]]( std::string_view prefix ) { return addrPath.starts_with( prefix ); } ) ) {
558 if ( msgLevel( MSG::DEBUG ) )
559 debug() << "Attempt to load " << addr->par()[1] << " from file " << addr->par()[0] << " blocked -- path inhibited"
560 << endmsg;
561 return StatusCode::SUCCESS;
562 }
563
564 auto object = createObj( *m_dataLoader, *addr ); // Call data loader
565 if ( !object ) return Status::INVALID_OBJECT;
566 auto fullpath = ( pReg ? pReg->identifier() : m_rootName.value() ) + std::string{ path };
567 // the data loader expects the path _including_ the root
568 LocalArena dummy_arena{ fullpath.size() + 1 };
569 auto dummy = Entry{ fullpath, {}, {}, &dummy_arena };
570 object->setRegistry( &dummy );
571 addr->setRegistry( &dummy );
572 auto status = m_dataLoader->fillObjRefs( addr.get(), object.get() );
573 if ( !status.isSuccess() ) return status;
574 // note: put will overwrite the registry in pObject to point at the
575 // one actually used -- so we do not dangle, pointing at dummy beyond its
576 // lifetime
577 if ( msgLevel( MSG::DEBUG ) ) {
578 auto ptr = object.get();
579 debug() << "registerAddress: " << std::quoted( normalize_path( fullpath, rootName() ) ) << " (DataObject*)"
580 << static_cast<void*>( ptr ) << ( ptr ? " -> " + System::typeinfoName( typeid( *ptr ) ) : std::string{} )
581 << endmsg;
582 }
583 fwd( [&]( Partition& p ) {
584 p.store->put( normalize_path( fullpath, rootName() ), std::move( object ), std::move( addr ) );
585 return StatusCode::SUCCESS;
586 } ).ignore();
587 return status;
588}
Gaudi::Property< std::vector< std::string > > m_inhibitPrefixes
SmartIF< IConversionSvc > m_dataLoader
Gaudi::Property< std::string > m_rootName
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition System.cpp:254

◆ registerAddress() [2/2]

StatusCode EvtStoreSvc::registerAddress ( std::string_view fullPath,
IOpaqueAddress * pAddress )
override

Definition at line 535 of file EvtStoreSvc.cpp.

535 {
536 return registerAddress( nullptr, path, pAddr );
537}
StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress) override

◆ registerObject() [1/2]

StatusCode EvtStoreSvc::registerObject ( DataObject * parentObj,
std::string_view objectPath,
DataObject * pObject )
override

Definition at line 595 of file EvtStoreSvc.cpp.

595 {
596 if ( parentObj ) return StatusCode::FAILURE;
597 return fwd( [&, object = std::unique_ptr<DataObject>( pObject ),
598 path = normalize_path( path, rootName() )]( Partition& p ) mutable {
599 if ( m_forceLeaves ) {
600 auto dir = path;
601 for ( auto i = dir.rfind( '/' ); i != std::string_view::npos; i = dir.rfind( '/' ) ) {
602 dir = dir.substr( 0, i );
603 if ( !p.store->find( dir ) ) {
604 if ( msgLevel( MSG::DEBUG ) ) {
605 debug() << "registerObject: adding directory " << std::quoted( dir ) << endmsg;
606 }
607 p.store->put( dir, std::unique_ptr<DataObject>{} );
608 }
609 }
610 }
611 if ( msgLevel( MSG::DEBUG ) ) {
612 auto ptr = object.get();
613 debug() << "registerObject: " << std::quoted( path ) << " (DataObject*)" << static_cast<void*>( ptr )
614 << ( ptr ? " -> " + System::typeinfoName( typeid( *ptr ) ) : std::string{} ) << endmsg;
615 }
616 p.store->put( path, std::move( object ) );
617 return StatusCode::SUCCESS;
618 } );
619}
Gaudi::Property< bool > m_forceLeaves

◆ registerObject() [2/2]

StatusCode EvtStoreSvc::registerObject ( std::string_view parentPath,
std::string_view objectPath,
DataObject * pObject )
override

Definition at line 589 of file EvtStoreSvc.cpp.

590 {
591 return parentPath.empty()
592 ? registerObject( nullptr, objectPath, pObject )
593 : registerObject( nullptr, std::string{ parentPath }.append( "/" ).append( objectPath ), pObject );
594}
StatusCode registerObject(std::string_view parentPath, std::string_view objectPath, DataObject *pObject) override

◆ removePreLoadItem()

StatusCode EvtStoreSvc::removePreLoadItem ( const DataStoreItem & item)
override

Definition at line 647 of file EvtStoreSvc.cpp.

647 {
648 auto i = std::remove( m_preLoads.begin(), m_preLoads.begin(), item );
649 m_preLoads.erase( i, m_preLoads.end() );
650 return StatusCode::SUCCESS;
651}

◆ resetPreLoad()

StatusCode EvtStoreSvc::resetPreLoad ( )
inlineoverride

Definition at line 341 of file EvtStoreSvc.cpp.

341 {
342 m_preLoads.clear();
343 return StatusCode::SUCCESS;
344 }

◆ retrieveObject()

StatusCode EvtStoreSvc::retrieveObject ( IRegistry * pDirectory,
std::string_view path,
DataObject *& pObject )
override

Definition at line 620 of file EvtStoreSvc.cpp.

620 {
621 if ( pDirectory ) return StatusCode::FAILURE;
622 return fwd( [&]( Partition& p ) {
623 path = normalize_path( path, rootName() );
624 pObject = const_cast<DataObject*>( p.store->get( path ) );
625 if ( msgLevel( MSG::DEBUG ) ) {
626 debug() << "retrieveObject: " << std::quoted( path ) << " (DataObject*)" << (void*)pObject
627 << ( pObject ? " -> " + System::typeinfoName( typeid( *pObject ) ) : std::string{} ) << endmsg;
628 }
629 return pObject ? StatusCode::SUCCESS : StatusCode::FAILURE;
630 } );
631}

◆ rootCLID()

CLID EvtStoreSvc::rootCLID ( ) const
override

Definition at line 391 of file EvtStoreSvc.cpp.

391{ return m_rootCLID; }
Gaudi::Property< CLID > m_rootCLID

◆ rootName()

const std::string & EvtStoreSvc::rootName ( ) const
override

Definition at line 392 of file EvtStoreSvc.cpp.

392{ return m_rootName; }

◆ selectStore()

StatusCode EvtStoreSvc::selectStore ( size_t partition)
override

Activate a partition object. The identifies the partition uniquely.

Definition at line 433 of file EvtStoreSvc.cpp.

433 {
434 s_current = &m_partitions[partition];
435 return StatusCode::SUCCESS;
436}

◆ setDataLoader()

StatusCode EvtStoreSvc::setDataLoader ( IConversionSvc * svc,
IDataProviderSvc * dpsvc )
override

Definition at line 393 of file EvtStoreSvc.cpp.

393 {
394 m_dataLoader = pDataLoader;
395 if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this ).ignore();
396 return StatusCode::SUCCESS;
397}

◆ setNumberOfStores()

StatusCode EvtStoreSvc::setNumberOfStores ( size_t slots)
override

Set the number of event slots (copies of DataSvc objects).

Definition at line 412 of file EvtStoreSvc.cpp.

412 {
413 if ( slots < size_t{ 1 } ) {
414 error() << "Invalid number of slots (" << slots << ")" << endmsg;
415 return StatusCode::FAILURE;
416 }
418 error() << "Too late to change the number of slots!" << endmsg;
419 return StatusCode::FAILURE;
420 }
421 m_slots = slots;
423 return StatusCode::SUCCESS;
424}
static void setNumConcEvents(const std::size_t &nE)
Set the number of concurrent events (for MT).
Gaudi::StateMachine::State FSMState() const override
Definition Service.h:55

◆ setRoot() [1/2]

StatusCode EvtStoreSvc::setRoot ( std::string root_name,
DataObject * pObject )
override

Definition at line 490 of file EvtStoreSvc.cpp.

490 {
491 if ( msgLevel( MSG::DEBUG ) ) {
492 debug() << "setRoot( " << root_path << ", (DataObject*)" << (void*)pObject << " )" << endmsg;
493 }
494 if ( !fwd( []( Partition& p ) {
495 return p.store->empty() ? StatusCode::SUCCESS : StatusCode::FAILURE;
496 } ).isSuccess() ) {
497 throw GaudiException{ "setRoot called with non-empty store", "EvtStoreSvc", StatusCode::FAILURE };
498 }
499 return registerObject( nullptr, root_path, pObject );
500}

◆ setRoot() [2/2]

StatusCode EvtStoreSvc::setRoot ( std::string root_path,
IOpaqueAddress * pRootAddr )
override

Definition at line 501 of file EvtStoreSvc.cpp.

501 {
502 auto rootAddr = std::unique_ptr<IOpaqueAddress>( pRootAddr );
503 if ( msgLevel( MSG::DEBUG ) ) {
504 debug() << "setRoot( " << root_path << ", (IOpaqueAddress*)" << rootAddr.get();
505 if ( rootAddr ) debug() << "[ " << rootAddr->par()[0] << ", " << rootAddr->par()[1] << " ]";
506 debug() << " )" << endmsg;
507 }
508 if ( !fwd( []( Partition& p ) {
509 return p.store->empty() ? StatusCode::SUCCESS : StatusCode::FAILURE;
510 } ).isSuccess() ) {
511 throw GaudiException{ "setRoot called with non-empty store", "EvtStoreSvc", StatusCode::FAILURE };
512 }
513 if ( !rootAddr ) return Status::INVALID_OBJ_ADDR; // Precondition: Address must be valid
515 fwd( [&]( Partition& p ) {
516 p.onlyThisID = rootAddr->par()[0];
517 return StatusCode::SUCCESS;
518 } ).ignore();
519 }
520 auto object = createObj( *m_dataLoader, *rootAddr ); // Call data loader
521 if ( !object ) return Status::INVALID_OBJECT;
522 if ( msgLevel( MSG::DEBUG ) ) { debug() << "Root Object " << root_path << " created " << endmsg; }
523 LocalArena dummy_arena{ root_path.size() + 1 };
524 auto dummy = Entry{ root_path, {}, {}, &dummy_arena };
525 object->setRegistry( &dummy );
526 rootAddr->setRegistry( &dummy );
527 auto status = m_dataLoader->fillObjRefs( rootAddr.get(), object.get() );
528 if ( status.isSuccess() ) {
529 auto pObject = object.get();
530 status = registerObject( nullptr, root_path, object.release() );
531 if ( status.isSuccess() ) pObject->registry()->setAddress( rootAddr.release() );
532 }
533 return status;
534}
Gaudi::Property< bool > m_followLinksToAncestors
str release
Definition conf.py:27

◆ traverseSubTree() [1/2]

StatusCode EvtStoreSvc::traverseSubTree ( DataObject * obj,
IDataStoreAgent * pAgent )
inlineoverride

Definition at line 305 of file EvtStoreSvc.cpp.

305 {
306 return ( obj && obj->registry() ) ? traverseSubTree( obj->registry()->identifier(), pAgent ) : StatusCode::FAILURE;
307 }
StatusCode traverseSubTree(std::string_view, IDataStoreAgent *) override

◆ traverseSubTree() [2/2]

StatusCode EvtStoreSvc::traverseSubTree ( std::string_view top,
IDataStoreAgent * pAgent )
override

Definition at line 469 of file EvtStoreSvc.cpp.

469 {
470 return fwd( [&]( Partition& p ) {
471 top = normalize_path( top, rootName() );
472 unsigned int nbSlashesInRootName = std::count( rootName().begin(), rootName().end(), '/' );
473 auto cmp = []( const Entry* lhs, const Entry* rhs ) { return lhs->identifier() < rhs->identifier(); };
474 std::set<const Entry*, decltype( cmp )> keys{ std::move( cmp ) };
475 for ( const auto& v : *p.store ) {
476 if ( v.second.identifier().starts_with( top ) ) keys.insert( &v.second );
477 }
478 auto k = keys.begin();
479 while ( k != keys.end() ) {
480 const auto& id = ( *k )->identifier();
481 int level = std::count( id.begin(), id.end(), '/' ) + nbSlashesInRootName;
482 bool accept = pAgent->analyse( const_cast<Entry*>( *( k++ ) ), level );
483 if ( !accept ) {
484 k = std::find_if_not( k, keys.end(), [&id]( const auto& e ) { return e->identifier().starts_with( id ); } );
485 }
486 }
487 return StatusCode::SUCCESS;
488 } );
489}
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.

◆ traverseTree()

StatusCode EvtStoreSvc::traverseTree ( IDataStoreAgent * pAgent)
inlineoverride

Definition at line 308 of file EvtStoreSvc.cpp.

308{ return traverseSubTree( std::string_view{}, pAgent ); }

◆ unlinkObject() [1/3]

StatusCode EvtStoreSvc::unlinkObject ( DataObject * ,
std::string_view  )
inlineoverride

Definition at line 350 of file EvtStoreSvc.cpp.

350{ return dummy( __FUNCTION__ ); }

◆ unlinkObject() [2/3]

StatusCode EvtStoreSvc::unlinkObject ( IRegistry * ,
std::string_view  )
inlineoverride

Definition at line 349 of file EvtStoreSvc.cpp.

349{ return dummy( __FUNCTION__ ); }

◆ unlinkObject() [3/3]

StatusCode EvtStoreSvc::unlinkObject ( std::string_view )
inlineoverride

Definition at line 351 of file EvtStoreSvc.cpp.

351{ return dummy( __FUNCTION__ ); }

◆ unregisterAddress() [1/2]

StatusCode EvtStoreSvc::unregisterAddress ( IRegistry * ,
std::string_view  )
inlineoverride

Definition at line 314 of file EvtStoreSvc.cpp.

314{ return dummy( __FUNCTION__ ); };

◆ unregisterAddress() [2/2]

StatusCode EvtStoreSvc::unregisterAddress ( std::string_view )
inlineoverride

Definition at line 313 of file EvtStoreSvc.cpp.

313{ return dummy( __FUNCTION__ ); };

◆ unregisterObject() [1/3]

StatusCode EvtStoreSvc::unregisterObject ( DataObject * obj)
inlineoverride

Definition at line 322 of file EvtStoreSvc.cpp.

322 {
323 return ( obj && obj->registry() ) ? unregisterObject( obj->registry()->identifier() ) : StatusCode::FAILURE;
324 }
StatusCode unregisterObject(std::string_view) override

◆ unregisterObject() [2/3]

StatusCode EvtStoreSvc::unregisterObject ( DataObject * obj,
std::string_view sr )
inlineoverride

Definition at line 325 of file EvtStoreSvc.cpp.

325 {
326 return !obj ? unregisterObject( sr )
327 : obj->registry() ? unregisterObject( ( obj->registry()->identifier() + '/' ).append( sr ) )
328 : StatusCode::FAILURE;
329 };
constexpr double sr

◆ unregisterObject() [3/3]

StatusCode EvtStoreSvc::unregisterObject ( std::string_view sr)
override

Definition at line 638 of file EvtStoreSvc.cpp.

638 {
639 sr = normalize_path( sr, rootName() );
640 return fwd( [&]( Partition& p ) { return p.store->erase( sr ) != 0 ? StatusCode::SUCCESS : StatusCode::FAILURE; } );
641}

◆ updateObject() [1/2]

StatusCode EvtStoreSvc::updateObject ( DataObject * )
inlineoverride

Definition at line 337 of file EvtStoreSvc.cpp.

337{ return dummy( __FUNCTION__ ); }

◆ updateObject() [2/2]

StatusCode EvtStoreSvc::updateObject ( IRegistry * )
inlineoverride

Definition at line 336 of file EvtStoreSvc.cpp.

336{ return dummy( __FUNCTION__ ); }

Member Data Documentation

◆ m_dataLoader

SmartIF<IConversionSvc> EvtStoreSvc::m_dataLoader
private

Definition at line 253 of file EvtStoreSvc.cpp.

◆ m_estStoreBuckets

Gaudi::Property<std::size_t> EvtStoreSvc::m_estStoreBuckets
private
Initial value:
{ this, "StoreBuckets", 100,
"Estimated number of buckets in the store" }

Definition at line 224 of file EvtStoreSvc.cpp.

224 { this, "StoreBuckets", 100,
225 "Estimated number of buckets in the store" };

◆ m_followLinksToAncestors

Gaudi::Property<bool> EvtStoreSvc::m_followLinksToAncestors
private
Initial value:
{
this, "FollowLinksToAncestors", true,
"Load objects which reside in files other than the one corresponding to the root of the event store" }

Definition at line 268 of file EvtStoreSvc.cpp.

268 {
269 this, "FollowLinksToAncestors", true,
270 "Load objects which reside in files other than the one corresponding to the root of the event store" };

◆ m_forceLeaves

Gaudi::Property<bool> EvtStoreSvc::m_forceLeaves
private
Initial value:
{ this, "ForceLeaves", false,
"force creation of default leaves on registerObject" }

Definition at line 218 of file EvtStoreSvc.cpp.

218 { this, "ForceLeaves", false,
219 "force creation of default leaves on registerObject" };

◆ m_freeSlots

tbb::concurrent_queue<size_t> EvtStoreSvc::m_freeSlots
private

Definition at line 261 of file EvtStoreSvc.cpp.

◆ m_inhibitPrefixes

Gaudi::Property<std::vector<std::string> > EvtStoreSvc::m_inhibitPrefixes
private
Initial value:
{
this,
"InhibitedPathPrefixes",
{},
"Prefixes of TES locations that will not be loaded by the persistency service " }

Definition at line 263 of file EvtStoreSvc.cpp.

263 {
264 this,
265 "InhibitedPathPrefixes",
266 {},
267 "Prefixes of TES locations that will not be loaded by the persistency service " };

◆ m_loader

Gaudi::Property<std::string> EvtStoreSvc::m_loader { this, "DataLoader", "EventPersistencySvc" }
private

Definition at line 220 of file EvtStoreSvc.cpp.

220{ this, "DataLoader", "EventPersistencySvc" };

◆ m_partitions

std::vector<SynchronizedPartition> EvtStoreSvc::m_partitions
private

The actual store(s).

Definition at line 259 of file EvtStoreSvc.cpp.

◆ m_poolSize

Gaudi::Property<std::size_t> EvtStoreSvc::m_poolSize { this, "PoolSize", 1024, "Initial per-event memory pool size [KiB]" }
private

Definition at line 223 of file EvtStoreSvc.cpp.

223{ this, "PoolSize", 1024, "Initial per-event memory pool size [KiB]" };

◆ m_preLoads

std::vector<DataStoreItem> EvtStoreSvc::m_preLoads
private

Items to be pre-loaded.

Definition at line 256 of file EvtStoreSvc.cpp.

◆ m_printPoolStats

Gaudi::Property<bool> EvtStoreSvc::m_printPoolStats { this, "PrintPoolStats", false, "Print memory pool statistics" }
private

Definition at line 222 of file EvtStoreSvc.cpp.

222{ this, "PrintPoolStats", false, "Print memory pool statistics" };

◆ m_rootCLID

Gaudi::Property<CLID> EvtStoreSvc::m_rootCLID { this, "RootCLID", 110 , "CLID of root entry" }
private

Definition at line 216 of file EvtStoreSvc.cpp.

216{ this, "RootCLID", 110 /*CLID_Event*/, "CLID of root entry" };

◆ m_rootName

Gaudi::Property<std::string> EvtStoreSvc::m_rootName { this, "RootName", "/Event", "name of root entry" }
private

Definition at line 217 of file EvtStoreSvc.cpp.

217{ this, "RootName", "/Event", "name of root entry" };

◆ m_servedPoolAllocations

Gaudi::Accumulators::AveragingCounter<std::size_t> EvtStoreSvc::m_servedPoolAllocations
private

Definition at line 226 of file EvtStoreSvc.cpp.

◆ m_slots

Gaudi::Property<size_t> EvtStoreSvc::m_slots { this, "EventSlots", 1, "number of event slots" }
private

Definition at line 221 of file EvtStoreSvc.cpp.

221{ this, "EventSlots", 1, "number of event slots" };

◆ m_storeBuckets

Gaudi::Accumulators::AveragingCounter<std::size_t> EvtStoreSvc::m_storeBuckets
private

Definition at line 227 of file EvtStoreSvc.cpp.

◆ m_storeEntries

Gaudi::Accumulators::AveragingCounter<std::size_t> EvtStoreSvc::m_storeEntries
private

Definition at line 227 of file EvtStoreSvc.cpp.

◆ m_usedPoolAllocations

Gaudi::Accumulators::AveragingCounter<std::size_t> EvtStoreSvc::m_usedPoolAllocations
private

Definition at line 227 of file EvtStoreSvc.cpp.

◆ m_usedPoolSize

Gaudi::Accumulators::AveragingCounter<std::size_t> EvtStoreSvc::m_usedPoolSize
mutableprivate

Definition at line 226 of file EvtStoreSvc.cpp.


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