18 #define DATASVC_MULTISTORESVC_CPP 49 struct Partition final {
59 return dataProvider.get();
63 return dataManager.get();
67 template <
typename lambda>
68 struct arg_helper :
public arg_helper<decltype( &lambda::operator() )> {};
69 template <
typename T,
typename Ret,
typename Arg>
70 struct arg_helper<Ret ( T::* )( Arg ) const> {
76 template <
typename lambda>
79 auto visit = [](
auto&& variant,
auto&&... lambdas ) -> decltype(
auto ) {
114 std::variant<std::monostate, ADDRESS*, OBJECT*>
root;
122 template <
typename Fun>
124 auto* svc =
m_current.get<std::decay_t<detail::argument_t<Fun>>>();
180 if ( p ) p->release();
182 []( std::monostate ) {} );
205 if ( p ) p->release();
207 []( std::monostate ) {} );
220 if ( p ) p->release();
222 []( std::monostate ) {} );
316 return create( nam, typ, pPartition );
336 i->second.dataManager->clearStore().ignore();
346 [&]( Partitions::const_reference p ) {
return p.second.dataProvider == provider; } );
348 i->second.dataManager->clearStore().ignore();
370 [&]( Partitions::const_reference p ) {
return p.second.dataProvider == provider; } );
380 pPartition = i->second.dataProvider;
383 pPartition =
nullptr;
395 pPartition =
nullptr;
403 error() <<
"Failed to retrieve data loader " 408 auto dataLoader = service<IConversionSvc>(
m_loader,
true );
410 error() <<
"Failed to retrieve data loader " 415 if ( !sc.isSuccess() ) {
416 error() <<
"Failed to set data loader " 435 error() <<
"Failed to connect to all store partitions." <<
endmsg;
445 error() <<
"Enable to reinitialize base class" <<
endmsg;
451 error() <<
"Failed to attach necessary services." <<
endmsg;
456 error() <<
"Failed to connect to store partitions." <<
endmsg;
476 using extends::extends;
493 if ( !address ) return StatusCode::FAILURE;
494 ADDRESS* pAdd = nullptr;
495 ADDRESS* p = address;
496 auto sc = m_addrCreator->createAddress( p->svcType(), p->clID(), p->par(), p->ipar(), pAdd );
497 return sc.isSuccess() ? i.second.dataManager->setRoot( m_root.path, pAdd ) : sc;
500 if ( object && object->clID() == CLID_DataObject ) {
501 return i.second.dataManager->setRoot( m_root.path, new DataObject() );
506 if ( !sc.isSuccess() ) iret = sc;
513 for (
auto& i : m_partitions ) i.second.dataManager->clearStore().
ignore();
514 m_partitions.clear();
522 clearPartitions().ignore();
523 for (
auto part : m_partitionDefs ) {
524 for (
auto attrib : Parser(
std::move( part ) ) ) {
525 switch ( ::
toupper( attrib.tag[0] ) ) {
536 if ( m_defaultPartition.empty() ) m_defaultPartition = nam;
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
StatusCode detachServices()
Parse attribute strings allowing iteration over the various attributes.
StatusCode registerAddress(std::string_view path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store.
Requested interface is not available.
StatusCode create(CSTR &nam, CSTR &typ) override
Create a partition object. The name identifies the partition uniquely.
StatusCode removePreLoadItem(const DataStoreItem &item) override
Remove an item from the preload list.
StatusCode initialize() override
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
std::variant< std::monostate, ADDRESS *, OBJECT * > root
StatusCode clearSubTree(std::string_view path) override
Remove all data objects below the sub tree identified.
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 ...
StatusCode clearStore() override
IDataManagerSvc: Remove all data objects in the data store.
Partitions m_partitions
Datastore partitions.
StatusCode unlinkObject(std::string_view path) override
Remove a link to another object.
StatusCode traverseTree(AGENT *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects in the data store.
virtual StatusCode registerAddress(std::string_view fullPath, IOpaqueAddress *pAddress)=0
Register object address with the data store.
virtual StatusCode linkObject(IRegistry *from, std::string_view objPath, DataObject *toObj)=0
Add a link to another object.
struct MultiStoreSvc::tagROOT m_root
StatusCode finalize() override
Implementation of property with value of concrete type.
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.
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list.
StatusCode objectLeaves(const OBJECT *pObject, std::vector< IRegistry * > &leaves) override
Explore the object store: retrieve all leaves attached to the object.
StatusCode unregisterObject(std::string_view path) override
Unregister object from the data store.
Root type (address or object)
virtual StatusCode unregisterAddress(std::string_view fullPath)=0
Unregister object address from the data store.
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
constexpr static const auto SUCCESS
virtual StatusCode preLoad()=0
Load all preload items of the list.
StatusCode registerAddress(IRegistry *parent, std::string_view path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store.
StatusCode unlinkObject(OBJECT *from, std::string_view objPath) override
Remove a link to another object.
virtual StatusCode resetPreLoad()=0
Clear the preload list.
StatusCode linkObject(std::string_view fullPath, OBJECT *to) override
Add a link to another object.
Gaudi::Property< CLID > m_rootCLID
StatusCode unlinkObject(IRegistry *from, std::string_view objPath) override
Remove a link to another object.
Data provider interface definition.
Description of the DataStoreItem class.
TYPE * get() const
Get interface pointer.
virtual StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent)=0
IDataManagerSvc: Explore the object store: retrieve the object's parent.
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
virtual StatusCode findObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Find object identified by its directory entry.
virtual StatusCode unlinkObject(IRegistry *from, std::string_view objPath)=0
Remove a link to another object.
StatusCode registerObject(std::string_view parent, std::string_view obj, OBJECT *pObj) override
Register object with the data store.
Invalid root path object cannot be retrieved or stored.
StatusCode attachServices()
#define DECLARE_COMPONENT(type)
std::vector< std::string > PartitionDefs
virtual StatusCode removePreLoadItem(const DataStoreItem &item)=0
Remove an item from the preload list.
virtual StatusCode unregisterObject(std::string_view fullPath)=0
Unregister object from the data store.
StatusCode get(CSTR &nam, IInterface *&pPartition) const override
Access a partition object. The name identifies the partition uniquely.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
const std::string & name() const override
Retrieve name of the service.
StatusCode setRoot(std::string path, OBJECT *pObj) override
Initialize data store for new event by giving new event path and root object.
virtual StatusCode clearSubTree(std::string_view sub_path)=0
Remove all data objects below the sub tree identified by its full path name.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode unregisterAddress(std::string_view path) override
IDataManagerSvc: Unregister object address from the data store.
TupleObj.h GaudiAlg/TupleObj.h namespace with few technical implementations.
General service interface definition.
This class is used for returning status codes from appropriate routines.
typename arg_helper< lambda >::type argument_t
StatusCode drop(CSTR &nam) override
Drop a partition object. The name identifies the partition uniquely.
virtual StatusCode updateObject(IRegistry *pDirectory)=0
Update object identified by its directory entry.
StatusCode updateObject(IRegistry *pDirectory) override
Update object identified by its directory entry.
Definition of the basic interface.
StatusCode findObject(IRegistry *parent, std::string_view path, OBJECT *&pObj) override
Find object identified by its full path in the data store.
Gaudi::Property< std::string > m_loader
StatusCode clearPartitions()
Clear all partitions.
StatusCode unregisterObject(OBJECT *pObj) override
Unregister object from the data store.
Gaudi::Property< std::string > m_defaultPartition
StatusCode findObject(std::string_view path, OBJECT *&pObj) override
Find object identified by its full path in the data store.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
StatusCode preparePartitions()
Prepare partition for usage.
StatusCode reinitialize() override
unsigned int CLID
Class ID definition.
StatusCode registerObject(OBJECT *parent, std::string_view obj, OBJECT *pObj) override
Register object with the data store.
StatusCode traverseSubTree(OBJECT *pObject, AGENT *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree.
CLID rootCLID() const override
IDataManagerSvc: Accessor for root event CLID.
const std::string & rootName() const override
Name for root Event.
Partition m_current
Current partition.
Gaudi::Property< std::string > m_rootName
StatusCode objectParent(const OBJECT *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
StatusCode drop(IInterface *pPartition) override
Drop a partition object. The name identifies the partition uniquely.
StatusCode objectLeaves(const IRegistry *pObject, std::vector< IRegistry * > &leaves) override
Explore the object store: retrieve all leaves attached to the object.
StatusCode traverseSubTree(std::string_view path, AGENT *pAgent) override
Analyze by traversing all data objects below the sub tree.
const StatusCode & ignore() const
Ignore/check StatusCode.
StatusCode create(CSTR &nam, CSTR &typ, IInterface *&pPartition) override
Create a partition object. The name identifies the partition uniquely.
virtual StatusCode retrieveObject(IRegistry *pDirectory, std::string_view path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
Generic data agent interface.
StatusCode resetPreLoad() override
Clear the preload list.
StatusCode registerObject(std::string_view fullPath, DataObject *pObject)
Register object with the data store.
Base class used to extend a class implementing other interfaces.
StatusCode setRoot(std::string path, ADDRESS *pAddr) override
Initialize data store for new event by giving new event path and address of root object.
StatusCode updateObject(OBJECT *pObj) override
Update object.
StatusCode activePartition(std::string &nam, IInterface *&pPartition) const override
Access the active partition object.
SmartIF< IAddressCreator > m_addrCreator
Reference to address creator.
StatusCode activate(CSTR &nam) override
Activate a partition object. The name identifies the partition uniquely.
StatusCode unregisterAddress(IRegistry *pParent, std::string_view path) override
IDataManagerSvc: Unregister object address from the data store.
StatusCode activate(IInterface *pPartition) override
Activate a partition object.
constexpr static const auto FAILURE
StatusCode initialize() override
Service initialisation.
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 setDataLoader(IConversionSvc *pDataLoader, IDataProviderSvc *dpsvc=nullptr) override
IDataManagerSvc: Pass a default data loader to the service.
StatusCode addPreLoadItem(const DataStoreItem &item) override
Add an item to the preload list.
StatusCode unregisterObject(OBJECT *pObj, std::string_view path) override
Unregister object from the data store.
StatusCode retrieveObject(IRegistry *parent, std::string_view path, OBJECT *&pObj) override
Retrieve object from data store.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
StatusCode makePartitions()
Create all partitions according to job options.
StatusCode clearSubTree(OBJECT *pObject) override
Remove all data objects below the sub tree identified.
Opaque address interface definition.
Gaudi::Property< PartitionDefs > m_partitionDefs
StatusCode reinitialize() override
Service initialisation.
StatusCode objectParent(const IRegistry *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object's parent.
StatusCode finalize() override
Service initialisation.
StatusCode preLoad() override
load all preload items of the list
std::map< std::string, Partition > Partitions
A DataObject is the base class of any identifiable object on any data store.
auto overload(lambda_ts &&... lambdas)
void toupper(std::string &s)
StatusCode linkObject(IRegistry *from, std::string_view objPath, OBJECT *to) override
Add a link to another object.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
~MultiStoreSvc() override
Standard Destructor.
virtual unsigned long addRef()=0
Add reference to object.