The Gaudi Framework  v29r0 (ff2e7097)
IODataManager.h
Go to the documentation of this file.
1 #ifndef GAUDIUTILS_IODATAMANAGER_H
2 #define GAUDIUTILS_IODATAMANAGER_H
3 
4 // C++ include files
5 #include <map>
6 // Framework include files
7 #include "GaudiKernel/Service.h"
9 
10 class IIncidentSvc;
11 
12 /*
13  * LHCb namespace declaration
14  */
15 namespace Gaudi
16 {
17 
18  // Forward declarations
19  class IFileCatalog;
20  class RawDataConnectionEntry;
21 
30  class IODataManager : public extends<Service, IIODataManager>
31  {
32  protected:
33  typedef const std::string& CSTR;
34  struct Entry final {
36  IoType ioType;
38  bool keepOpen;
39  Entry( CSTR tech, bool k, IoType iot, IDataConnection* con )
40  : type( tech ), ioType( iot ), connection( con ), keepOpen( k )
41  {
42  }
43  };
46 
47  Gaudi::Property<std::string> m_catalogSvcName{this, "CatalogType", "Gaudi::MultiFileCatalog/FileCatalog",
48  "name of the file catalog service"};
49  Gaudi::Property<bool> m_useGFAL{this, "UseGFAL", true, "flag for auto gfal data access"};
50  Gaudi::Property<bool> m_quarantine{this, "QuarantineFiles", true,
51  "if unaccessible files should be quarantines in job"};
52  Gaudi::Property<int> m_ageLimit{this, "AgeLimit", 2, "age limit"};
54  this, "DisablePFNWarning", false,
55  "if set to True, we will not report when a file is opened by its physical name"};
56 
58  ConnectionMap m_connectionMap;
62  FidMap m_fidMap;
63  StatusCode connectDataIO( int typ, IoType rw, CSTR fn, CSTR technology, bool keep, Connection* con );
65  StatusCode error( CSTR msg, bool rethrow );
66  StatusCode establishConnection( Connection* con );
67 
69 
70  public:
72  using extends::extends;
73 
75  ~IODataManager() override = default;
76 
78  StatusCode initialize() override;
79 
81  StatusCode finalize() override;
82 
84  StatusCode connectRead( bool keep_open, Connection* ioDesc ) override;
86  StatusCode connectWrite( Connection* con, IoType mode = Connection::CREATE, CSTR doctype = "UNKNOWN" ) override;
88  StatusCode disconnect( Connection* ioDesc ) override;
90  Connection* connection( const std::string& dsn ) const override;
92  Connections connections( const IInterface* owner ) const override;
94  StatusCode read( Connection* ioDesc, void* const data, size_t len ) override;
96  StatusCode write( Connection* con, const void* data, int len ) override;
98  long long int seek( Connection* ioDesc, long long int where, int origin ) override;
99  };
100 } // End namespace Gaudi
101 #endif // GAUDIUTILS_IODATAMANAGER_H
StatusCode finalize() override
IService implementation: finalize the service.
Gaudi::Property< int > m_ageLimit
Definition: IODataManager.h:52
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:15
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
Implementation of property with value of concrete type.
Definition: Property.h:319
Connections connections(const IInterface *owner) const override
Get connection by owner instance (0=ALL)
StatusCode disconnect(Connection *ioDesc) override
Release data stream.
Gaudi::Property< std::string > m_catalogSvcName
Definition: IODataManager.h:47
SmartIF< IIncidentSvc > m_incSvc
Definition: IODataManager.h:68
Entry(CSTR tech, bool k, IoType iot, IDataConnection *con)
Definition: IODataManager.h:39
StatusCode establishConnection(Connection *con)
~IODataManager() override=default
Standard destructor.
StatusCode read(Connection *ioDesc, void *const data, size_t len) override
Read raw byte buffer from input stream.
STL class.
std::map< std::string, std::string > FidMap
Definition: IODataManager.h:45
Gaudi::Property< bool > m_quarantine
Definition: IODataManager.h:50
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode initialize() override
IService implementation: initialize the service.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
SmartIF< IFileCatalog > m_catalog
Reference to file catalog.
Definition: IODataManager.h:60
Definition of the basic interface.
Definition: IInterface.h:277
StatusCode write(Connection *con, const void *data, int len) override
Write raw byte buffer to output stream.
Definition: IODataManager.h:34
Gaudi::Property< bool > m_useGFAL
Definition: IODataManager.h:49
StatusCode connectWrite(Connection *con, IoType mode=Connection::CREATE, CSTR doctype="UNKNOWN") override
Open data stream in write mode.
std::string type
Definition: IODataManager.h:35
std::map< std::string, Entry * > ConnectionMap
Definition: IODataManager.h:44
ABC describing basic data connection.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
ConnectionMap m_connectionMap
Map with I/O descriptors.
Definition: IODataManager.h:58
IDataConnection * connection
Definition: IODataManager.h:37
const std::string & CSTR
Definition: IODataManager.h:33
Gaudi::Property< bool > m_disablePFNWarning
Definition: IODataManager.h:53
StatusCode connectDataIO(int typ, IoType rw, CSTR fn, CSTR technology, bool keep, Connection *con)
StatusCode connectRead(bool keep_open, Connection *ioDesc) override
Open data stream in read mode.
bool keepOpen
Definition: IODataManager.h:38
long long int seek(Connection *ioDesc, long long int where, int origin) override
Seek on the file described by ioDesc. Arguments as in ::seek()
Helper functions to set/get the application return code.
Definition: __init__.py:1
StatusCode reconnect(Entry *e)
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
IoType ioType
Definition: IODataManager.h:36
FidMap m_fidMap
Map of FID to PFN.
Definition: IODataManager.h:62