ATLAS Offline Software
Loading...
Searching...
No Matches
DbStorageTool Class Reference

The DbStorageTool class is able to handle user request for. More...

#include <StorageSvc/DbStorageTool.h>

Inheritance diagram for DbStorageTool:
Collaboration diagram for DbStorageTool:

Public Member Functions

 DbStorageTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor for a Gaudi component.
virtual ~DbStorageTool ()
 Standard destructor.
 DbStorageTool (const DbStorageTool &)=delete
DbStorageTool & operator= (const DbStorageTool &)=delete
virtual const std::string & name () const override final
 Retrieve the name of this tool.
virtual StatusCode write (FileDescriptor &refDB, const std::string &refCont, int technology, const void *object, const RootType type, Token *&refpTok) override final
 Register object for write.
virtual StatusCode read (FileDescriptor &refDB, const Token &persToken, void **object) override final
 Read a persistent object from the medium.
virtual std::string getContName (FileDescriptor &refDB, Token &persToken) const override final
 Get container name for object.
virtual StatusCode getShape (FileDescriptor &refDB, const Guid &objType, const DbTypeInfo *&tinfo) override final
 Retrieve persistent tinfo from Storage manager.
virtual const DbTypeInfo * createShape (const Guid &typeID) override final
 Create a Shape representation based on a ShapeID.
virtual StatusCode startSession (Io::IoFlag mode, int tech, int ageLimit=-1) override final
 Start a new Database Session.
virtual StatusCode endSession () override final
 End the Database session.
virtual StatusCode connect (Io::IoFlag mode, FileDescriptor &refDB) override final
 Connect to a logical Database unit.
virtual StatusCode disconnect (FileDescriptor &refDB) override final
 Disconnect from a logical Database unit.
virtual StatusCode openMode (FileDescriptor &refDB, Io::IoFlag &mode) override final
 Query the access mode of a Database unit.
virtual StatusCode endTransaction (FileDescriptor &refDB, Transaction::Action typ) override final
 End/Finish an existing Transaction sequence.
virtual StatusCode getDomainOption (DbOption &opt) override final
 Access options for a given database domain.
virtual StatusCode setDomainOption (const DbOption &opt) override final
 Set options for a given database domain.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Member Functions

ITechFactory * getTechFactory ()
 Access technology implementations.

Private Attributes

std::string m_name
 Service Name.
DbDomain m_domH
 Database domain handle.
int m_ageLimit
 Property: AgeLimit indicating the maximal allowed age of files.
DbType m_type
 Technology type.
ITechFactory * m_techFactory
 Loaded StorageSvc implementation type (for m_type).

Detailed Description

The DbStorageTool class is able to handle user request for.

  • transient objects to become persistent and
  • persistent objects to be made transient. What the storage manager however needs to perform this task are object mappings, which translate between the two representations.

This functionality is defined in the IStorageTool interface and implemented in the DbStorageTool class. Please refer to the header file StorageSvc/IStorageTool for further details.

Author
Markus Frank

Definition at line 28 of file DbStorageTool.h.

Constructor & Destructor Documentation

◆ DbStorageTool() [1/2]

DbStorageTool::DbStorageTool ( const std::string & type,
const std::string & name,
const IInterface * parent )
explicit

Standard constructor for a Gaudi component.

◆ ~DbStorageTool()

virtual DbStorageTool::~DbStorageTool ( )
virtual

Standard destructor.

◆ DbStorageTool() [2/2]

DbStorageTool::DbStorageTool ( const DbStorageTool & )
delete

Member Function Documentation

◆ connect()

virtual StatusCode DbStorageTool::connect ( Io::IoFlag mode,
FileDescriptor & refDB )
finaloverridevirtual

Connect to a logical Database unit.

A connection is equivalent to the triple (OCISession, OCIServer, OCISvcCtx) in ORACLE, a login to a datasource using ODBC, or a single federation for Objectivity. For file based technologies, such as root, MS Access, ODBC/Text etc., this is involves the opening of the requested file.

Parameters
mode[IN] Flag to indicate the accessmode of the session. READ, NEW/CREATE/WRITE, UPDATE, RECREATE.
refDB[I/O] Descriptor of the Database to be opened. On successful return the Database handle is valid.
Returns
StatusCode code indicating success or failure.

Implements IStorageTool.

◆ createShape()

virtual const DbTypeInfo * DbStorageTool::createShape ( const Guid & typeID)
finaloverridevirtual

Create a Shape representation based on a ShapeID.

Parameters
typeID[IN] Type identifier.
Returns
Handle to persistent mapping of a given object type.

Implements IStorageTool.

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ disconnect()

virtual StatusCode DbStorageTool::disconnect ( FileDescriptor & refDB)
finaloverridevirtual

Disconnect from a logical Database unit.

The request for disconnect requires, that all pending Transactions are already commited. Otherwise data are lost. On disconnection the access to the Database is finalized, closed. The token will be invalidated may not be used at any longer after disconnection.

Parameters
refDB[IN] Descriptor of the Database access. This handle was retrieved when connecting to the logical Database. On successful return the Database handle will be invalidated.
Returns
StatusCode code indicating success or failure.

Implements IStorageTool.

◆ endSession()

virtual StatusCode DbStorageTool::endSession ( )
inlinefinaloverridevirtual

End the Database session.

The request to end a Database session requires, that all pending Transactions and connections are closed. Otherwise internally the close will be forced and potentially data on pending Transactions will be lost.

Returns
StatusCode code indicating success or failure.

Implements IStorageTool.

Definition at line 145 of file DbStorageTool.h.

146 { return m_domH.close(); }
DbDomain m_domH
Database domain handle.

◆ endTransaction()

virtual StatusCode DbStorageTool::endTransaction ( FileDescriptor & refDB,
Transaction::Action typ )
finaloverridevirtual

End/Finish an existing Transaction sequence.

At this phase all objects, which were marked for write when the Transaction was started, are either going to be made persistent or scratched. After the Transaction ended, the Transaction context is invalidated and may no longer be used independent wether the Transaction was successful or not.

Parameters
conn[IN] DB connection
typ[IN] Enum indicating an action to be performed. Valid arguments are COMMIT
Returns
StatusCode code indicating success or failure.

Implements IStorageTool.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getContName()

virtual std::string DbStorageTool::getContName ( FileDescriptor & refDB,
Token & persToken ) const
finaloverridevirtual

Get container name for object.

Parameters
refDB[IN] Reference to Database descriptor
pToken[IN] Token to the persistent object.
Returns
std::string container name.

Implements IStorageTool.

◆ getDomainOption()

virtual StatusCode DbStorageTool::getDomainOption ( DbOption & opt)
inlinefinaloverridevirtual

Access options for a given database domain.

Domain options are global options, which refer to the database technology and not to a particular connection.

Note: The options depend on the underlying implementation and are not normalized.

Parameters
opt[IN] Reference to option object.
Returns
StatusCode code indicating success or failure.

Implements IStorageTool.

Definition at line 219 of file DbStorageTool.h.

220 { return m_domH.getOption(opt); }

◆ getShape()

virtual StatusCode DbStorageTool::getShape ( FileDescriptor & refDB,
const Guid & objType,
const DbTypeInfo *& tinfo )
finaloverridevirtual

Retrieve persistent tinfo from Storage manager.

The persistent tinfo is saved at write time to a Database. To match the transient tinfo of an object to the persistent tinfo of the data at the time the data were written should allow for schema evolution and object transformation(s).

Parameters
refDB[IN] Reference to Database descriptor
objType[IN] Shape identifier.
tinfo[OUT] Persistent tinfo of a given object type.
Returns
StatusCode code indicating success or failure.

Implements IStorageTool.

◆ getTechFactory()

ITechFactory * DbStorageTool::getTechFactory ( )
private

Access technology implementations.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ name()

virtual const std::string & DbStorageTool::name ( ) const
inlinefinaloverridevirtual

Retrieve the name of this tool.

Definition at line 53 of file DbStorageTool.h.

53{ return m_name; }
std::string m_name
Service Name.

◆ openMode()

virtual StatusCode DbStorageTool::openMode ( FileDescriptor & refDB,
Io::IoFlag & mode )
finaloverridevirtual

Query the access mode of a Database unit.

Parameters
refDB[IN] Descriptor of the Database to be queried.
mode[OUT] Open mod to the database.
Returns
StatusCode code indicating success or failure.

Implements IStorageTool.

◆ operator=()

DbStorageTool & DbStorageTool::operator= ( const DbStorageTool & )
delete

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ read()

virtual StatusCode DbStorageTool::read ( FileDescriptor & refDB,
const Token & persToken,
void ** object )
finaloverridevirtual

Read a persistent object from the medium.

Reading an object does not create the object.

Parameters
refDB[IN] Reference to Database descriptor
persToken[IN] Reference to persistent token information.
object[OUT] Pointer to persistent data pointer.
Returns
StatusCode code indicating success or failure.

Implements IStorageTool.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ setDomainOption()

virtual StatusCode DbStorageTool::setDomainOption ( const DbOption & opt)
inlinefinaloverridevirtual

Set options for a given database domain.

Domain options are global options, which refer to the database technology and not to a particular connection.

Note: The options depend on the underlying implementation and are not normalized.

Parameters
opt[IN] Reference to option object.
Returns
StatusCode code indicating success or failure.

Implements IStorageTool.

Definition at line 233 of file DbStorageTool.h.

234 { return m_domH.setOption(opt); }

◆ startSession()

virtual StatusCode DbStorageTool::startSession ( Io::IoFlag mode,
int tech,
int ageLimit = -1 )
finaloverridevirtual

Start a new Database Session.

The Database session handles Databases of one given type. This involves specific handling of a given domain represented by a technology type. All subsequent actions involving Database actions will re-use this technology identifier. The session is a purely logical concept, which typically cannot fail unless the underlying technology requires global initialization calls.

Parameters
mode[IN] Flag to indicate the accessmode of the session. READ, NEW/CREATE/WRITE, UPDATE, RECREATE
tech[IN] Flag indicating the technology type of the Database the user wants to connect to.
ageLimit[IN] Overwriting default age limit of the session.
Returns
StatusCode code indicating success or failure.

Implements IStorageTool.

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ write()

virtual StatusCode DbStorageTool::write ( FileDescriptor & refDB,
const std::string & refCont,
int technology,
const void * object,
const RootType type,
Token *& refpTok )
finaloverridevirtual

Register object for write.

Parameters
refDB[IN] Reference to Database descriptor
refCont[IN] Reference to container name
technology[IN]Specialised sub-technology
object[IN] Pointer to persistent data object.
type[IN] Persistent type information
refpTok[OUT] Reference to location for storing the pointer of the persistent object token.
Returns
StatusCode code indicating success or failure.

Implements IStorageTool.

Member Data Documentation

◆ m_ageLimit

int DbStorageTool::m_ageLimit
private

Property: AgeLimit indicating the maximal allowed age of files.

Definition at line 36 of file DbStorageTool.h.

◆ m_domH

DbDomain DbStorageTool::m_domH
private

Database domain handle.

Definition at line 34 of file DbStorageTool.h.

◆ m_name

std::string DbStorageTool::m_name
private

Service Name.

Definition at line 32 of file DbStorageTool.h.

◆ m_techFactory

ITechFactory* DbStorageTool::m_techFactory
private

Loaded StorageSvc implementation type (for m_type).

Definition at line 40 of file DbStorageTool.h.

◆ m_type

DbType DbStorageTool::m_type
private

Technology type.

Definition at line 38 of file DbStorageTool.h.


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