The Gaudi Framework  v30r3 (a5ef0a68)
MultiStoreSvc.cpp
Go to the documentation of this file.
1 //====================================================================
2 // MultiStoreSvc.cpp
3 //--------------------------------------------------------------------
4 //
5 // Package : System ( The LHCb Offline System)
6 //
7 // Description: implementation of the Transient event data service.
8 //
9 // Author : M.Frank
10 // History :
11 // +---------+----------------------------------------------+---------
12 // | Date | Comment | Who
13 // +---------+----------------------------------------------+---------
14 // | 29/10/98| Initial version | MF
15 // +---------+----------------------------------------------+---------
16 //
17 //====================================================================
18 #define DATASVC_MULTISTORESVC_CPP
19 
20 // Include files
22 #include "GaudiKernel/DataObject.h"
31 #include "GaudiKernel/MsgStream.h"
32 #include "GaudiKernel/Service.h"
33 #include "GaudiKernel/SmartIF.h"
35 #include "GaudiKernel/compose.h"
36 #include "boost/variant.hpp"
37 #include <map>
38 
39 // Forward declarations
40 // This class
42 
43 typedef const std::string CSTR;
47 
48 namespace
49 {
50  struct Partition final {
51  SmartIF<IDataProviderSvc> dataProvider;
52  SmartIF<IDataManagerSvc> dataManager;
54 
55  template <typename T>
56  T* get();
57  };
58  template <>
59  IDataProviderSvc* Partition::get<IDataProviderSvc>()
60  {
61  return dataProvider.get();
62  }
63  template <>
64  IDataManagerSvc* Partition::get<IDataManagerSvc>()
65  {
66  return dataManager.get();
67  }
68 
69  namespace detail
70  {
71  template <typename lambda>
72  struct arg_helper : public arg_helper<decltype( &lambda::operator() )> {
73  };
74  template <typename T, typename Ret, typename Arg>
75  struct arg_helper<Ret ( T::* )( Arg ) const> {
76  using type = Arg;
77  };
78 
79  // given a unary lambda whose argument is of type Arg_t,
80  // argument_t<lambda> will be equal to Arg_t
81  template <typename lambda>
82  using argument_t = typename arg_helper<lambda>::type;
83  }
84  auto dispatch_variant = []( auto&& variant, auto&&... lambdas ) -> decltype( auto ) {
85  return boost::apply_visitor( compose( std::forward<decltype( lambdas )>( lambdas )... ),
86  std::forward<decltype( variant )>( variant ) );
87  };
88 }
89 
101 class MultiStoreSvc : public extends<Service, IDataProviderSvc, IDataManagerSvc, IPartitionControl>
102 {
103 protected:
106 
107  Gaudi::Property<CLID> m_rootCLID{this, "RootCLID", 110, "CLID of root entry"};
108  Gaudi::Property<std::string> m_rootName{this, "RootName", "/Event", "name of root entry"};
109  Gaudi::Property<PartitionDefs> m_partitionDefs{this, "Partitions", {}, "datastore partition definitions"};
110  Gaudi::Property<std::string> m_loader{this, "DataLoader", "EventPersistencySvc", "data loader name"};
111  Gaudi::Property<std::string> m_defaultPartition{this, "DefaultPartition", "Default", "default partition name"};
112 
118  struct tagROOT {
120  boost::variant<boost::blank, ADDRESS*, OBJECT*> root;
121  } m_root;
123  Partition m_current;
125  Partitions m_partitions;
126 
127  // member templates to help writing the function calls
128  template <typename Fun>
129  StatusCode fwd( Fun f )
130  {
131  auto* svc = m_current.get<std::decay_t<detail::argument_t<Fun>>>();
132  return svc ? f( *svc ) : IDataProviderSvc::Status::INVALID_ROOT;
133  }
134 
135 public:
137  CLID rootCLID() const override { return m_rootCLID; }
139  const std::string& rootName() const override { return m_rootName; }
140 
142  StatusCode registerAddress( boost::string_ref path, ADDRESS* pAddr ) override
143  {
144  return fwd( [&]( IDataManagerSvc& svc ) { return svc.registerAddress( path, pAddr ); } );
145  }
147  StatusCode registerAddress( OBJECT* parent, boost::string_ref path, ADDRESS* pAddr ) override
148  {
149  return fwd( [&]( IDataManagerSvc& svc ) { return svc.registerAddress( parent, path, pAddr ); } );
150  }
152  StatusCode registerAddress( IRegistry* parent, boost::string_ref path, ADDRESS* pAddr ) override
153  {
154  return fwd( [&]( IDataManagerSvc& svc ) { return svc.registerAddress( parent, path, pAddr ); } );
155  }
157  StatusCode unregisterAddress( boost::string_ref path ) override
158  {
159  return fwd( [&]( IDataManagerSvc& svc ) { return svc.unregisterAddress( path ); } );
160  }
162  StatusCode unregisterAddress( OBJECT* pParent, boost::string_ref path ) override
163  {
164  return fwd( [&]( IDataManagerSvc& svc ) { return svc.unregisterAddress( pParent, path ); } );
165  }
167  StatusCode unregisterAddress( IRegistry* pParent, boost::string_ref path ) override
168  {
169  return fwd( [&]( IDataManagerSvc& svc ) { return svc.unregisterAddress( pParent, path ); } );
170  }
172  StatusCode objectLeaves( const OBJECT* pObject, std::vector<IRegistry*>& leaves ) override
173  {
174  return fwd( [&]( IDataManagerSvc& svc ) { return svc.objectLeaves( pObject, leaves ); } );
175  }
177  StatusCode objectLeaves( const IRegistry* pObject, std::vector<IRegistry*>& leaves ) override
178  {
179  return fwd( [&]( IDataManagerSvc& svc ) { return svc.objectLeaves( pObject, leaves ); } );
180  }
182  StatusCode objectParent( const OBJECT* pObject, IRegistry*& refpParent ) override
183  {
184  return fwd( [&]( IDataManagerSvc& svc ) { return svc.objectParent( pObject, refpParent ); } );
185  }
187  StatusCode objectParent( const IRegistry* pObject, IRegistry*& refpParent ) override
188  {
189  return fwd( [&]( IDataManagerSvc& svc ) { return svc.objectParent( pObject, refpParent ); } );
190  }
192  StatusCode clearSubTree( boost::string_ref path ) override
193  {
194  return fwd( [&]( IDataManagerSvc& svc ) { return svc.clearSubTree( path ); } );
195  }
197  StatusCode clearSubTree( OBJECT* pObject ) override
198  {
199  return fwd( [&]( IDataManagerSvc& svc ) { return svc.clearSubTree( pObject ); } );
200  }
203  {
204  for ( auto& i : m_partitions ) {
205  i.second.dataManager->clearStore().ignore();
206  }
207  dispatch_variant( m_root.root,
208  []( auto* p ) {
209  if ( p ) p->release();
210  },
211  []( boost::blank ) {} );
212  m_root.root = {};
213  m_root.path.clear();
214  return StatusCode::SUCCESS;
215  }
217  StatusCode traverseSubTree( boost::string_ref path, AGENT* pAgent ) override
218  {
219  return fwd( [&]( IDataManagerSvc& svc ) { return svc.traverseSubTree( path, pAgent ); } );
220  }
222  StatusCode traverseSubTree( OBJECT* pObject, AGENT* pAgent ) override
223  {
224  return fwd( [&]( IDataManagerSvc& svc ) { return svc.traverseSubTree( pObject, pAgent ); } );
225  }
227  StatusCode traverseTree( AGENT* pAgent ) override
228  {
229  return fwd( [&]( IDataManagerSvc& svc ) { return svc.traverseTree( pAgent ); } );
230  }
234  {
235  dispatch_variant( m_root.root,
236  []( auto* p ) {
237  if ( p ) p->release();
238  },
239  []( boost::blank ) {} );
240  m_root.path = std::move( path );
241  m_root.root = pObj;
242  preparePartitions();
243  return activate( m_defaultPartition );
244  }
245 
249  {
250  dispatch_variant( m_root.root,
251  []( auto* p ) {
252  if ( p ) p->release();
253  },
254  []( boost::blank ) {} );
255  m_root.path = std::move( path );
256  m_root.root = pAddr;
257  if ( !pAddr ) return StatusCode::FAILURE;
258  pAddr->addRef();
259  preparePartitions();
260  return activate( m_defaultPartition );
261  }
263  StatusCode setDataLoader( IConversionSvc* pDataLoader, IDataProviderSvc* dpsvc = nullptr ) override
264  {
265  m_dataLoader = pDataLoader;
266  if ( m_dataLoader ) m_dataLoader->setDataProvider( dpsvc ? dpsvc : this );
267  for ( auto& i : m_partitions ) {
268  i.second.dataManager->setDataLoader( m_dataLoader.get() ).ignore();
269  }
270  return StatusCode::SUCCESS;
271  }
273  StatusCode addPreLoadItem( const DataStoreItem& item ) override
274  {
275  return fwd( [&]( IDataProviderSvc& svc ) { return svc.addPreLoadItem( item ); } );
276  }
279  {
280  return fwd( [&]( IDataProviderSvc& svc ) { return svc.addPreLoadItem( std::move( item ) ); } );
281  }
284  {
285  return fwd( [&]( IDataProviderSvc& svc ) { return svc.removePreLoadItem( item ); } );
286  }
289  {
290  return fwd( [&]( IDataProviderSvc& svc ) { return svc.removePreLoadItem( std::move( item ) ); } );
291  }
294  {
295  return fwd( [&]( IDataProviderSvc& svc ) { return svc.resetPreLoad(); } );
296  }
298  StatusCode preLoad() override
299  {
300  return fwd( [&]( IDataProviderSvc& svc ) { return svc.preLoad(); } );
301  }
303  StatusCode registerObject( boost::string_ref path, OBJECT* pObj ) override
304  {
305  return registerObject( nullptr, path, pObj );
306  }
308  StatusCode registerObject( boost::string_ref parent, boost::string_ref obj, OBJECT* pObj ) override
309  {
310  return fwd( [&]( IDataProviderSvc& svc ) { return svc.registerObject( parent, obj, pObj ); } );
311  }
313  StatusCode registerObject( boost::string_ref parent, int item, OBJECT* pObj ) override
314  {
315  return fwd( [&]( IDataProviderSvc& svc ) { return svc.registerObject( parent, item, pObj ); } );
316  }
318  StatusCode registerObject( OBJECT* parent, boost::string_ref obj, OBJECT* pObj ) override
319  {
320  return fwd( [&]( IDataProviderSvc& svc ) { return svc.registerObject( parent, obj, pObj ); } );
321  }
323  StatusCode registerObject( OBJECT* parent, int obj, OBJECT* pObj ) override
324  {
325  return fwd( [&]( IDataProviderSvc& svc ) { return svc.registerObject( parent, obj, pObj ); } );
326  }
328  StatusCode unregisterObject( boost::string_ref path ) override
329  {
330  return fwd( [&]( IDataProviderSvc& svc ) { return svc.unregisterObject( path ); } );
331  }
333  StatusCode unregisterObject( boost::string_ref parent, boost::string_ref obj ) override
334  {
335  return fwd( [&]( IDataProviderSvc& svc ) { return svc.unregisterObject( parent, obj ); } );
336  }
338  StatusCode unregisterObject( boost::string_ref parent, int obj ) override
339  {
340  return fwd( [&]( IDataProviderSvc& svc ) { return svc.unregisterObject( parent, obj ); } );
341  }
344  {
345  return fwd( [&]( IDataProviderSvc& svc ) { return svc.unregisterObject( pObj ); } );
346  }
348  StatusCode unregisterObject( OBJECT* pObj, boost::string_ref path ) override
349  {
350  return fwd( [&]( IDataProviderSvc& svc ) { return svc.unregisterObject( pObj, path ); } );
351  }
353  StatusCode unregisterObject( OBJECT* pObj, int item ) override
354  {
355  return fwd( [&]( IDataProviderSvc& svc ) { return svc.unregisterObject( pObj, item ); } );
356  }
358  StatusCode retrieveObject( IRegistry* parent, boost::string_ref path, OBJECT*& pObj ) override
359  {
360  return fwd( [&]( IDataProviderSvc& svc ) { return svc.retrieveObject( parent, path, pObj ); } );
361  }
363  StatusCode retrieveObject( boost::string_ref path, OBJECT*& pObj ) override
364  {
365  return fwd( [&]( IDataProviderSvc& svc ) { return svc.retrieveObject( path, pObj ); } );
366  }
368  StatusCode retrieveObject( boost::string_ref parent, boost::string_ref path, OBJECT*& pObj ) override
369  {
370  return fwd( [&]( IDataProviderSvc& svc ) { return svc.retrieveObject( parent, path, pObj ); } );
371  }
373  StatusCode retrieveObject( boost::string_ref parent, int item, OBJECT*& pObj ) override
374  {
375  return fwd( [&]( IDataProviderSvc& svc ) { return svc.retrieveObject( parent, item, pObj ); } );
376  }
378  StatusCode retrieveObject( OBJECT* parent, boost::string_ref path, OBJECT*& pObj ) override
379  {
380  return fwd( [&]( IDataProviderSvc& svc ) { return svc.retrieveObject( parent, path, pObj ); } );
381  }
383  StatusCode retrieveObject( OBJECT* parent, int item, OBJECT*& pObj ) override
384  {
385  return fwd( [&]( IDataProviderSvc& svc ) { return svc.retrieveObject( parent, item, pObj ); } );
386  }
388  StatusCode findObject( boost::string_ref path, OBJECT*& pObj ) override
389  {
390  return fwd( [&]( IDataProviderSvc& svc ) { return svc.retrieveObject( path, pObj ); } );
391  }
393  StatusCode findObject( IRegistry* parent, boost::string_ref path, OBJECT*& pObj ) override
394  {
395  return fwd( [&]( IDataProviderSvc& svc ) { return svc.findObject( parent, path, pObj ); } );
396  }
398  StatusCode findObject( boost::string_ref parent, boost::string_ref path, OBJECT*& pObj ) override
399  {
400  return fwd( [&]( IDataProviderSvc& svc ) { return svc.retrieveObject( parent, path, pObj ); } );
401  }
403  StatusCode findObject( boost::string_ref parent, int item, OBJECT*& pObject ) override
404  {
405  return fwd( [&]( IDataProviderSvc& svc ) { return svc.findObject( parent, item, pObject ); } );
406  }
408  StatusCode findObject( OBJECT* parent, boost::string_ref path, OBJECT*& pObject ) override
409  {
410  return fwd( [&]( IDataProviderSvc& svc ) { return svc.findObject( parent, path, pObject ); } );
411  }
413  StatusCode findObject( OBJECT* parent, int item, OBJECT*& pObject ) override
414  {
415  return fwd( [&]( IDataProviderSvc& svc ) { return svc.findObject( parent, item, pObject ); } );
416  }
418  StatusCode linkObject( IRegistry* from, boost::string_ref objPath, OBJECT* to ) override
419  {
420  return fwd( [&]( IDataProviderSvc& svc ) { return svc.linkObject( from, objPath, to ); } );
421  }
423  StatusCode linkObject( boost::string_ref from, boost::string_ref objPath, OBJECT* to ) override
424  {
425  return fwd( [&]( IDataProviderSvc& svc ) { return svc.linkObject( from, objPath, to ); } );
426  }
428  StatusCode linkObject( OBJECT* from, boost::string_ref objPath, OBJECT* to ) override
429  {
430  return fwd( [&]( IDataProviderSvc& svc ) { return svc.linkObject( from, objPath, to ); } );
431  }
433  StatusCode linkObject( boost::string_ref fullPath, OBJECT* to ) override
434  {
435  return fwd( [&]( IDataProviderSvc& svc ) { return svc.linkObject( fullPath, to ); } );
436  }
438  StatusCode unlinkObject( IRegistry* from, boost::string_ref objPath ) override
439  {
440  return fwd( [&]( IDataProviderSvc& svc ) { return svc.unlinkObject( from, objPath ); } );
441  }
443  StatusCode unlinkObject( boost::string_ref from, boost::string_ref objPath ) override
444  {
445  return fwd( [&]( IDataProviderSvc& svc ) { return svc.unlinkObject( from, objPath ); } );
446  }
448  StatusCode unlinkObject( OBJECT* from, boost::string_ref objPath ) override
449  {
450  return fwd( [&]( IDataProviderSvc& svc ) { return svc.unlinkObject( from, objPath ); } );
451  }
453  StatusCode unlinkObject( boost::string_ref path ) override
454  {
455  return fwd( [&]( IDataProviderSvc& svc ) { return svc.unlinkObject( path ); } );
456  }
458  StatusCode updateObject( IRegistry* pDirectory ) override
459  {
460  return fwd( [&]( IDataProviderSvc& svc ) { return svc.updateObject( pDirectory ); } );
461  }
463  StatusCode updateObject( boost::string_ref path ) override
464  {
465  return fwd( [&]( IDataProviderSvc& svc ) { return svc.updateObject( path ); } );
466  }
468  StatusCode updateObject( OBJECT* pObj ) override
469  {
470  return fwd( [&]( IDataProviderSvc& svc ) { return svc.updateObject( pObj ); } );
471  }
473  StatusCode updateObject( boost::string_ref parent, boost::string_ref updatePath ) override
474  {
475  return fwd( [&]( IDataProviderSvc& svc ) { return svc.updateObject( parent, updatePath ); } );
476  }
478  StatusCode updateObject( OBJECT* parent, boost::string_ref updatePath ) override
479  {
480  return fwd( [&]( IDataProviderSvc& svc ) { return svc.updateObject( parent, updatePath ); } );
481  }
482 
484  StatusCode create( CSTR& nam, CSTR& typ ) override
485  {
486  IInterface* pPartition = nullptr;
487  return create( nam, typ, pPartition );
488  }
490  StatusCode create( CSTR& nam, CSTR& typ, IInterface*& pPartition ) override
491  {
492  if ( get( nam, pPartition ).isSuccess() ) return IPartitionControl::Status::PARTITION_EXISTS;
494  auto isvc = serviceLocator()->service<IService>( typ );
495  if ( !isvc ) return IInterface::Status::NO_INTERFACE;
496  auto dataMgr = isvc.as<IDataManagerSvc>();
497  auto dataProv = isvc.as<IDataProviderSvc>();
498  if ( !dataMgr || !dataProv ) return IInterface::Status::NO_INTERFACE;
499  m_partitions.emplace( nam, Partition{dataProv, dataMgr, nam} );
500  return StatusCode::SUCCESS;
501  }
502 
504  StatusCode drop( CSTR& nam ) override
505  {
506  auto i = m_partitions.find( nam );
507  if ( i == m_partitions.end() ) return IPartitionControl::Status::PARTITION_NOT_PRESENT;
508  if ( i->second.dataManager == m_current.dataManager ) {
509  m_current = Partition();
510  }
511  i->second.dataManager->clearStore().ignore();
512  m_partitions.erase( i );
513  return StatusCode::SUCCESS;
514  }
515 
517  StatusCode drop( IInterface* pPartition ) override
518  {
519  auto provider = SmartIF<IDataProviderSvc>( pPartition );
520  if ( !provider ) return IInterface::Status::NO_INTERFACE;
521  auto i = std::find_if( std::begin( m_partitions ), std::end( m_partitions ),
522  [&]( Partitions::const_reference p ) { return p.second.dataProvider == provider; } );
523  if ( i == std::end( m_partitions ) ) return IPartitionControl::Status::PARTITION_NOT_PRESENT;
524  i->second.dataManager->clearStore().ignore();
525  m_partitions.erase( i );
526  return StatusCode::SUCCESS;
527  }
528 
530  StatusCode activate( CSTR& nam ) override
531  {
532  auto i = m_partitions.find( nam );
533  if ( i != m_partitions.end() ) {
534  m_current = i->second;
535  return StatusCode::SUCCESS;
536  }
537  m_current = {};
539  }
540 
542  StatusCode activate( IInterface* pPartition ) override
543  {
544  auto provider = SmartIF<IDataProviderSvc>( pPartition );
545  m_current = Partition();
546  if ( !provider ) return IInterface::Status::NO_INTERFACE;
547  auto i = std::find_if( std::begin( m_partitions ), std::end( m_partitions ),
548  [&]( Partitions::const_reference p ) { return p.second.dataProvider == provider; } );
549  if ( i == std::end( m_partitions ) ) return IPartitionControl::Status::PARTITION_NOT_PRESENT;
550  m_current = i->second;
551  return StatusCode::SUCCESS;
552  }
553 
555  StatusCode get( CSTR& nam, IInterface*& pPartition ) const override
556  {
557  auto i = m_partitions.find( nam );
558  if ( i != m_partitions.end() ) {
559  pPartition = i->second.dataProvider;
560  return StatusCode::SUCCESS;
561  }
562  pPartition = nullptr;
564  }
565 
567  StatusCode activePartition( std::string& nam, IInterface*& pPartition ) const override
568  {
569  if ( m_current.dataProvider ) {
570  nam = m_current.name;
571  pPartition = m_current.dataProvider;
572  return StatusCode::SUCCESS;
573  }
574  nam.clear();
575  pPartition = nullptr;
577  }
578 
580  {
581  // Attach address creator facility
582  m_addrCreator = service( m_loader, true );
583  if ( !m_addrCreator ) {
584  error() << "Failed to retrieve data loader "
585  << "\"" << m_loader << "\"" << endmsg;
586  return StatusCode::FAILURE;
587  }
588  // Attach data loader facility
589  auto dataLoader = service<IConversionSvc>( m_loader, true );
590  if ( !dataLoader ) {
591  error() << "Failed to retrieve data loader "
592  << "\"" << m_loader << "\"" << endmsg;
593  return StatusCode::FAILURE;
594  }
595  auto sc = setDataLoader( dataLoader.get() );
596  if ( !sc.isSuccess() ) {
597  error() << "Failed to set data loader "
598  << "\"" << m_loader << "\"" << endmsg;
599  }
600  return sc;
601  }
602 
604  {
605  m_addrCreator.reset();
606  m_dataLoader.reset();
607  return StatusCode::SUCCESS;
608  }
609 
612  {
613  // Nothing to do: just call base class initialisation
615  if ( !sc.isSuccess() ) return sc;
616  sc = makePartitions();
617  if ( !sc.isSuccess() ) {
618  error() << "Failed to connect to all store partitions." << endmsg;
619  return sc;
620  }
621  return attachServices();
622  }
623 
626  {
628  if ( !sc.isSuccess() ) {
629  error() << "Enable to reinitialize base class" << endmsg;
630  return sc;
631  }
632  detachServices();
633  sc = attachServices();
634  if ( !sc.isSuccess() ) {
635  error() << "Failed to attach necessary services." << endmsg;
636  return sc;
637  }
638  sc = makePartitions();
639  if ( !sc.isSuccess() ) {
640  error() << "Failed to connect to store partitions." << endmsg;
641  return sc;
642  }
643  // return
644  return StatusCode::SUCCESS;
645  }
646 
648  StatusCode finalize() override
649  {
650  setDataLoader( nullptr ).ignore();
651  clearStore().ignore();
652  clearPartitions().ignore();
653  m_current = Partition();
654  detachServices();
655  return Service::finalize();
656  }
657 
658  // protected:
659 
661  using extends::extends;
662 
664  ~MultiStoreSvc() override
665  {
666  setDataLoader( nullptr ).ignore();
667  resetPreLoad().ignore();
668  clearStore().ignore();
669  clearPartitions().ignore();
670  }
671 
674  {
676  for ( auto& i : m_partitions ) {
677  StatusCode sc =
678  dispatch_variant( m_root.root,
679  [&]( ADDRESS* address ) -> StatusCode {
680  if ( !address ) return StatusCode::FAILURE;
681  ADDRESS* pAdd = nullptr;
682  ADDRESS* p = address;
683  auto sc =
684  m_addrCreator->createAddress( p->svcType(), p->clID(), p->par(), p->ipar(), pAdd );
685  return sc.isSuccess() ? i.second.dataManager->setRoot( m_root.path, pAdd ) : sc;
686  },
687  [&]( OBJECT* object ) -> StatusCode {
688  if ( object && object->clID() == CLID_DataObject ) {
689  return i.second.dataManager->setRoot( m_root.path, new DataObject() );
690  }
691  return StatusCode::FAILURE;
692  },
693  []( boost::blank ) -> StatusCode { return StatusCode::FAILURE; } );
694  if ( !sc.isSuccess() ) iret = sc;
695  }
696  return iret;
697  }
698 
701  {
702  for ( auto& i : m_partitions ) i.second.dataManager->clearStore().ignore();
703  m_partitions.clear();
704  return StatusCode::SUCCESS;
705  }
706 
709  {
710  using Parser = Gaudi::Utils::AttribStringParser;
711  std::string typ, nam;
712  clearPartitions().ignore();
713  for ( auto part : m_partitionDefs ) {
714  for ( auto attrib : Parser( std::move( part ) ) ) {
715  switch (::toupper( attrib.tag[0] ) ) {
716  case 'N':
717  nam = std::move( attrib.value );
718  break;
719  case 'T':
720  typ = std::move( attrib.value );
721  break;
722  }
723  }
724  StatusCode sc = create( nam, typ );
725  if ( !sc.isSuccess() ) return sc;
726  if ( m_defaultPartition.empty() ) m_defaultPartition = nam;
727  }
728  return StatusCode::SUCCESS;
729  }
730 };
731 
732 // Instantiation of a static factory class used by clients to create
733 // instances of this service
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 unregisterAddress(boost::string_ref path) override
IDataManagerSvc: Unregister object address from 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.
constexpr static const auto FAILURE
Definition: StatusCode.h:88
StatusCode removePreLoadItem(const DataStoreItem &item) override
Remove an item from the preload list.
StatusCode registerObject(OBJECT *parent, boost::string_ref obj, OBJECT *pObj) override
Register object with the data store.
StatusCode initialize() override
Definition: Service.cpp:63
StatusCode clearSubTree(boost::string_ref 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.
virtual StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath)=0
Remove a link to another object.
Partitions m_partitions
Datastore partitions.
StatusCode fwd(Fun f)
StatusCode traverseTree(AGENT *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects in the data store.
StatusCode finalize() override
Definition: Service.cpp:173
Implementation of property with value of concrete type.
Definition: Property.h:381
StatusCode retrieveObject(OBJECT *parent, int item, OBJECT *&pObj) override
Retrieve object from data store.
virtual StatusCode addPreLoadItem(const DataStoreItem &item)=0
Add an item to the preload list.
const std::string & rootName() const override
Name for root Event.
CLID rootCLID() const override
IDataManagerSvc: Accessor for root event CLID.
StatusCode unlinkObject(IRegistry *from, boost::string_ref objPath) override
Remove a link to another object.
auto dispatch_variant
Definition: FunAdapters.h:29
virtual StatusCode findObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject)=0
Find object identified by its directory entry.
StatusCode objectLeaves(const OBJECT *pObject, std::vector< IRegistry * > &leaves) override
Explore the object store: retrieve all leaves attached to the object.
bool isSuccess() const
Definition: StatusCode.h:287
Root type (address or object)
virtual StatusCode setDataProvider(IDataProviderSvc *pService)=0
Set Data provider service.
boost::variant< boost::blank, ADDRESS *, OBJECT * > root
StatusCode registerObject(boost::string_ref path, OBJECT *pObj) override
Register object with the data store.
virtual StatusCode preLoad()=0
Load all preload items of the list.
virtual StatusCode resetPreLoad()=0
Clear the preload list.
StatusCode updateObject(boost::string_ref parent, boost::string_ref updatePath) override
Update object.
StatusCode linkObject(boost::string_ref from, boost::string_ref objPath, OBJECT *to) override
Add a link to another object.
StatusCode linkObject(boost::string_ref fullPath, OBJECT *to) override
Add a link to another object.
T end(T...args)
Data service base class.
StatusCode linkObject(IRegistry *from, boost::string_ref objPath, OBJECT *to) override
Add a link to another object.
Data provider interface definition.
Description of the DataStoreItem class.
Definition: DataStoreItem.h:17
StatusCode registerObject(boost::string_ref parent, int item, OBJECT *pObj) override
Register object with the data store.
StatusCode findObject(boost::string_ref path, OBJECT *&pObj) override
Find object identified by its full path in the data store.
virtual StatusCode objectParent(const DataObject *pObject, IRegistry *&refpParent)=0
IDataManagerSvc: Explore the object store: retrieve the object&#39;s parent.
SmartIF< IConversionSvc > m_dataLoader
Pointer to data loader service.
Invalid root path object cannot be retrieved or stored.
StatusCode attachServices()
STL class.
virtual StatusCode linkObject(IRegistry *from, boost::string_ref objPath, DataObject *toObj)=0
Add a link to another object.
#define DECLARE_COMPONENT(type)
std::vector< std::string > PartitionDefs
virtual StatusCode removePreLoadItem(const DataStoreItem &item)=0
Remove an item from the preload list.
StatusCode unregisterObject(boost::string_ref path) override
Unregister object from the data store.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
virtual StatusCode traverseSubTree(boost::string_ref sub_path, IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects below the sub tree identified by its full path name...
StatusCode setRoot(std::string path, OBJECT *pObj) override
Initialize data store for new event by giving new event path and root object.
TupleObj.h GaudiAlg/TupleObj.h namespace with few technical implementations.
StatusCode addPreLoadItem(std::string item) override
Add an item to the preload list.
StatusCode unregisterAddress(OBJECT *pParent, boost::string_ref path) override
IDataManagerSvc: Unregister object address from the data store.
StatusCode registerAddress(IRegistry *parent, boost::string_ref path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store.
StatusCode retrieveObject(OBJECT *parent, boost::string_ref path, OBJECT *&pObj) override
Retrieve object from data store.
General service interface definition.
Definition: IService.h:18
StatusCode findObject(IRegistry *parent, boost::string_ref path, OBJECT *&pObj) override
Find object identified by its full path in the data store.
StatusCode unregisterObject(boost::string_ref parent, boost::string_ref obj) override
Unregister object from the data store.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
typename arg_helper< lambda >::type argument_t
Definition: EventIDBase.h:35
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.
Definition: IInterface.h:277
StatusCode removePreLoadItem(std::string item) override
Add an item to the preload list.
T erase(T...args)
StatusCode clearPartitions()
Clear all partitions.
StatusCode unregisterObject(OBJECT *pObj) override
Unregister object from the data store.
StatusCode findObject(boost::string_ref parent, int item, OBJECT *&pObject) override
Find object in the data store.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
const std::string CSTR
StatusCode preparePartitions()
Prepare partition for usage.
StatusCode linkObject(OBJECT *from, boost::string_ref objPath, OBJECT *to) override
Add a link to another object.
DataObject OBJECT
StatusCode reinitialize() override
Definition: Service.cpp:249
StatusCode unlinkObject(boost::string_ref path) override
Remove a link to another object.
virtual StatusCode retrieveObject(IRegistry *pDirectory, boost::string_ref path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
virtual StatusCode clearSubTree(boost::string_ref sub_path)=0
Remove all data objects below the sub tree identified by its full path name.
T clear(T...args)
StatusCode retrieveObject(boost::string_ref parent, int item, OBJECT *&pObj) override
Retrieve object from data store.
T move(T...args)
StatusCode updateObject(boost::string_ref path) override
Update object.
StatusCode traverseSubTree(OBJECT *pObject, AGENT *pAgent) override
IDataManagerSvc: Analyze by traversing all data objects below the sub tree.
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Partition m_current
Current partition.
StatusCode findObject(OBJECT *parent, int item, OBJECT *&pObject) override
Find object in the data store.
StatusCode unlinkObject(boost::string_ref from, boost::string_ref objPath) override
Remove a link to another object.
StatusCode objectParent(const OBJECT *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object&#39;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.
virtual StatusCode unregisterAddress(boost::string_ref fullPath)=0
Unregister object address from the data store.
T find(T...args)
virtual StatusCode unregisterObject(boost::string_ref fullPath)=0
Unregister object from the data store.
StatusCode create(CSTR &nam, CSTR &typ, IInterface *&pPartition) override
Create a partition object. The name identifies the partition uniquely.
Generic data agent interface.
StatusCode resetPreLoad() override
Clear the preload list.
StatusCode updateObject(OBJECT *parent, boost::string_ref updatePath) override
Update object.
StatusCode retrieveObject(boost::string_ref parent, boost::string_ref path, OBJECT *&pObj) override
Retrieve object from data store.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
StatusCode findObject(boost::string_ref parent, boost::string_ref path, OBJECT *&pObj) override
Find object in the data store.
T begin(T...args)
virtual StatusCode registerObject(boost::string_ref fullPath, DataObject *pObject)=0
Register object with the data store.
StatusCode setRoot(std::string path, ADDRESS *pAddr) override
Initialize data store for new event by giving new event path and address of root object.
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
StatusCode registerObject(boost::string_ref parent, boost::string_ref obj, OBJECT *pObj) override
Register object with the data store.
StatusCode updateObject(OBJECT *pObj) override
Update object.
SmartIF< IAddressCreator > m_addrCreator
Reference to address creator.
virtual StatusCode registerAddress(boost::string_ref 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.
T emplace(T...args)
StatusCode activate(CSTR &nam) override
Activate a partition object. The name identifies the partition uniquely.
StatusCode activate(IInterface *pPartition) override
Activate a partition object.
StatusCode registerAddress(OBJECT *parent, boost::string_ref path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store.
StatusCode unregisterObject(boost::string_ref parent, int obj) override
Unregister object from the data store.
StatusCode initialize() override
Service initialisation.
StatusCode unregisterObject(OBJECT *pObj, boost::string_ref path) override
Unregister object from the data store.
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.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:92
auto compose(lambda_ts &&...lambdas)
Definition: compose.h:77
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.
StatusCode reinitialize() override
Service initialisation.
StatusCode objectParent(const IRegistry *pObject, IRegistry *&refpParent) override
IDataManagerSvc: Explore the object store: retrieve the object&#39;s parent.
IOpaqueAddress ADDRESS
StatusCode finalize() override
Service initialisation.
StatusCode traverseSubTree(boost::string_ref path, AGENT *pAgent) override
Analyze by traversing all data objects below the sub tree.
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.
Definition: DataObject.h:30
StatusCode unlinkObject(OBJECT *from, boost::string_ref objPath) override
Remove a link to another object.
StatusCode retrieveObject(IRegistry *parent, boost::string_ref path, OBJECT *&pObj) override
Retrieve object from data store.
StatusCode unregisterObject(OBJECT *pObj, int item) override
Unregister object from the data store.
T forward(T...args)
void toupper(std::string &s)
StatusCode unregisterAddress(IRegistry *pParent, boost::string_ref path) override
IDataManagerSvc: Unregister object address from the data store.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
IDataStoreAgent AGENT
StatusCode registerAddress(boost::string_ref path, ADDRESS *pAddr) override
IDataManagerSvc: Register object address with the data store.
StatusCode registerObject(OBJECT *parent, int obj, OBJECT *pObj) override
Register object with the data store.
StatusCode retrieveObject(boost::string_ref path, OBJECT *&pObj) override
Retrieve object identified by its full path from the data store.
~MultiStoreSvc() override
Standard Destructor.
virtual unsigned long addRef()=0
Add reference to object.
StatusCode findObject(OBJECT *parent, boost::string_ref path, OBJECT *&pObject) override
Find object in the data store.