Go to the documentation of this file.
28 #define DATASVC_MULTISTORESVC_CPP
59 struct Partition final {
69 return dataProvider.get();
73 return dataManager.get();
77 template <
typename lambda>
78 struct arg_helper :
public arg_helper<decltype( &lambda::operator() )> {};
79 template <
typename T,
typename Ret,
typename Arg>
80 struct arg_helper<Ret ( T::* )( Arg ) const> {
86 template <
typename lambda>
89 auto visit = [](
auto&& variant,
auto&&... lambdas ) -> decltype(
auto ) {
124 std::variant<std::monostate, ADDRESS*, OBJECT*>
root;
132 template <
typename Fun>
134 auto* svc =
m_current.get<std::decay_t<detail::argument_t<Fun>>>();
190 if ( p ) p->release();
192 []( std::monostate ) {} );
215 if ( p ) p->release();
217 []( std::monostate ) {} );
230 if ( p ) p->release();
232 []( std::monostate ) {} );
244 if (
auto sc =
m_dataLoader->setDataProvider( dpsvc ? dpsvc :
this ); !sc )
return sc;
246 if (
auto sc = i.second.dataManager->setDataLoader(
m_dataLoader.
get() ); !sc )
return sc;
329 return create( nam, typ, pPartition );
349 i->second.dataManager->clearStore().ignore();
359 [&]( Partitions::const_reference p ) {
return p.second.dataProvider == provider; } );
361 i->second.dataManager->clearStore().ignore();
383 [&]( Partitions::const_reference p ) {
return p.second.dataProvider == provider; } );
393 pPartition = i->second.dataProvider;
396 pPartition =
nullptr;
408 pPartition =
nullptr;
416 error() <<
"Failed to retrieve data loader "
421 auto dataLoader = service<IConversionSvc>(
m_loader,
true );
423 error() <<
"Failed to retrieve data loader "
428 if ( !sc.isSuccess() ) {
429 error() <<
"Failed to set data loader "
448 error() <<
"Failed to connect to all store partitions." <<
endmsg;
458 error() <<
"Enable to reinitialize base class" <<
endmsg;
463 error() <<
"Failed to detach necessary services." <<
endmsg;
468 error() <<
"Failed to attach necessary services." <<
endmsg;
473 error() <<
"Failed to connect to store partitions." <<
endmsg;
493 using extends::extends;
510 if ( !address ) return StatusCode::FAILURE;
511 ADDRESS* pAdd = nullptr;
512 ADDRESS* p = address;
513 auto sc = m_addrCreator->createAddress( p->svcType(), p->clID(), p->par(), p->ipar(), pAdd );
514 return sc.isSuccess() ? i.second.dataManager->setRoot( m_root.path, pAdd ) : sc;
517 if ( object && object->clID() == CLID_DataObject ) {
518 return i.second.dataManager->setRoot( m_root.path, new DataObject() );
523 if ( !sc.isSuccess() ) iret = sc;
530 for (
auto& i : m_partitions ) i.second.dataManager->clearStore().
ignore();
531 m_partitions.clear();
539 clearPartitions().ignore();
540 for (
auto part : m_partitionDefs ) {
541 for (
auto attrib : Parser(
std::move( part ) ) ) {
542 switch ( ::
toupper( attrib.tag[0] ) ) {
553 if ( m_defaultPartition.empty() ) m_defaultPartition = nam;
SmartIF< IAddressCreator > m_addrCreator
Reference to address creator.
Gaudi::Property< std::string > m_rootName
StatusCode traverseSubTree(std::string_view path, AGENT *pAgent) override
Analyze by traversing all data objects below the sub tree.
StatusCode drop(IInterface *pPartition) override
Drop a partition object. The name identifies the partition uniquely.
virtual StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent)=0
IDataManagerSvc: Explore the object store: retrieve the object's parent.
StatusCode registerObject(std::string_view parent, std::string_view obj, OBJECT *pObj) override
Register object with the data store.
StatusCode activate(IInterface *pPartition) override
Activate a partition object.
void toupper(std::string &s)
StatusCode unregisterAddress(IRegistry *pParent, std::string_view path) override
IDataManagerSvc: Unregister object address from the data store.
StatusCode resetPreLoad() override
Clear the preload list.
StatusCode initialize() override
virtual StatusCode unregisterObject(std::string_view fullPath)=0
Unregister object from the data store.
virtual StatusCode removePreLoadItem(const DataStoreItem &item)=0
Remove an item from the preload list.
StatusCode unregisterObject(OBJECT *pObj, std::string_view path) override
Unregister object from the data store.
virtual StatusCode unlinkObject(IRegistry *from, std::string_view objPath)=0
Remove a link to another object.
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
StatusCode updateObject(OBJECT *pObj) override
Update object.
std::variant< std::monostate, ADDRESS *, OBJECT * > root
StatusCode reinitialize() override
Service initialisation.
virtual unsigned long addRef()=0
Add reference to object.
std::vector< std::string > PartitionDefs
StatusCode objectParent(const IRegistry *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
StatusCode setRoot(std::string path, OBJECT *pObj) override
Initialize data store for new event by giving new event path and root object.
StatusCode findObject(IRegistry *parent, std::string_view path, OBJECT *&pObj) override
Find object identified by its full path in the data store.
StatusCode setDataLoader(IConversionSvc *pDataLoader, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: Pass a default data loader to the service.
StatusCode initialize() override
Service initialisation.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
StatusCode clearPartitions()
Clear all partitions.
virtual StatusCode objectLeaves(const DataObject *pObject, std::vector< IRegistry * > &refLeaves)=0
Explore the object store: retrieve all leaves attached to the object The object is identified by its ...
Gaudi::Property< PartitionDefs > m_partitionDefs
StatusCode finalize() override
Service initialisation.
StatusCode clearSubTree(OBJECT *pObject) override
Remove all data objects below the sub tree identified.
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
StatusCode preLoad() override
load all preload items of the list
@ NO_INTERFACE
Requested interface is not available.
StatusCode findObject(std::string_view path, OBJECT *&pObj) override
Find object identified by its full path in the data store.
virtual StatusCode resetPreLoad()=0
Clear the preload list.
StatusCode finalize() override
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list.
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
StatusCode registerAddress(std::string_view path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store.
virtual StatusCode traverseSubTree(std::string_view sub_tree_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name.
StatusCode registerObject(std::string_view fullPath, DataObject *pObject)
Register object with the data store.
StatusCode unlinkObject(std::string_view path) override
Remove a link to another object.
virtual StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *toObj)=0
Add a link to another object.
StatusCode objectParent(const OBJECT *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
@ INVALID_ROOT
Invalid root path object cannot be retrieved or stored.
const std::string & name() const override
Retrieve name of the service
virtual StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
StatusCode activePartition(std::string &nam, IInterface *&pPartition) const override
Access the active partition object.
virtual StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
StatusCode unlinkObject(OBJECT *from, std::string_view objPath) override
Remove a link to another object.
StatusCode activate(CSTR &nam) override
Activate a partition object. The name identifies the partition uniquely.
StatusCode unregisterObject(std::string_view path) override
Unregister object from the data store.
virtual StatusCode unregisterAddress(std::string_view fullPath)=0
Unregister object address from the data store.
virtual StatusCode preLoad()=0
Load all preload items of the list.
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
typename arg_helper< lambda >::type argument_t
std::map< std::string, Partition > Partitions
StatusCode linkObject(IRegistry *from, std::string_view objPath, OBJECT *to) override
Add a link to another object.
StatusCode makePartitions()
Create all partitions according to job options.
StatusCode addPreLoadItem(const DataStoreItem &item) override
Add an item to the preload list.
unsigned int CLID
Class ID definition.
StatusCode registerAddress(IRegistry *parent, std::string_view path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store.
StatusCode retrieveObject(IRegistry *parent, std::string_view path, OBJECT *&pObj) override
Retrieve object from data store.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Base class used to extend a class implementing other interfaces.
~MultiStoreSvc() override
Standard Destructor.
StatusCode detachServices()
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
StatusCode attachServices()
StatusCode removePreLoadItem(const DataStoreItem &item) override
Remove an item from the preload list.
StatusCode unlinkObject(IRegistry *from, std::string_view objPath) override
Remove a link to another object.
StatusCode clearSubTree(std::string_view path) override
Remove all data objects below the sub tree identified.
constexpr static const auto SUCCESS
TYPE * get() const
Get interface pointer.
StatusCode traverseTree(AGENT *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects in the data store.
Partitions m_partitions
Datastore partitions.
#define DECLARE_COMPONENT(type)
StatusCode create(CSTR &nam, CSTR &typ) override
Create a partition object. The name identifies the partition uniquely.
Gaudi::Property< std::string > m_loader
StatusCode get(CSTR &nam, IInterface *&pPartition) const override
Access a partition object. The name identifies the partition uniquely.
StatusCode unregisterAddress(std::string_view path) override
IDataManagerSvc: Unregister object address from the data store.
StatusCode reinitialize() override
StatusCode objectLeaves(const OBJECT *pObject, std::vector< IRegistry * > &leaves) override
Explore the object store: retrieve all leaves attached to the object.
Root type (address or object)
Gaudi::Property< std::string > m_defaultPartition
virtual StatusCode clearSubTree(std::string_view sub_path)=0
Remove all data objects below the sub tree identified by its full path name.
StatusCode drop(CSTR &nam) override
Drop a partition object. The name identifies the partition uniquely.
constexpr static const auto FAILURE
const std::string & rootName() const override
Name for root Event.
CLID rootCLID() const override
IDataManagerSvc: Accessor for root event CLID.
StatusCode linkObject(std::string_view fullPath, OBJECT *to) override
Add a link to another object.
StatusCode traverseSubTree(OBJECT *pObject, AGENT *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree.
StatusCode unregisterObject(OBJECT *pObj) override
Unregister object from the data store.
Gaudi::Property< CLID > m_rootCLID
StatusCode preparePartitions()
Prepare partition for usage.
Parse attribute strings allowing iteration over the various attributes.
Partition m_current
Current partition.
StatusCode create(CSTR &nam, CSTR &typ, IInterface *&pPartition) override
Create a partition object. The name identifies the partition uniquely.
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
StatusCode objectLeaves(const IRegistry *pObject, std::vector< IRegistry * > &leaves) override
Explore the object store: retrieve all leaves attached to the object.
StatusCode registerObject(OBJECT *parent, std::string_view obj, OBJECT *pObj) override
Register object with the data store.
virtual StatusCode updateObject(IRegistry *pDirectory)=0
Update object identified by its directory entry.
virtual StatusCode findObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Find object identified by its directory entry.
auto overload(lambda_ts &&... lambdas)
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
StatusCode setRoot(std::string path, ADDRESS *pAddr) override
Initialize data store for new event by giving new event path and address of root object.
struct MultiStoreSvc::tagROOT m_root