The Gaudi Framework  master (37c0b60a)
IODataManager.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIUTILS_IODATAMANAGER_H
12 #define GAUDIUTILS_IODATAMANAGER_H
13 
14 // C++ include files
15 #include <map>
16 // Framework include files
17 #include <GaudiKernel/Service.h>
19 
20 class IIncidentSvc;
21 
22 /*
23  * LHCb namespace declaration
24  */
25 namespace Gaudi {
26 
27  // Forward declarations
28  class IFileCatalog;
29  class RawDataConnectionEntry;
30 
39  class IODataManager : public extends<Service, IIODataManager> {
40  protected:
41  typedef const std::string& CSTR;
42  struct Entry final {
44  IoType ioType;
46  bool keepOpen;
47  Entry( CSTR tech, bool k, IoType iot, IDataConnection* con )
48  : type( tech ), ioType( iot ), connection( con ), keepOpen( k ) {}
49  };
52 
53  Gaudi::Property<std::string> m_catalogSvcName{ this, "CatalogType", "Gaudi::MultiFileCatalog/FileCatalog",
54  "name of the file catalog service" };
55  Gaudi::Property<bool> m_useGFAL{ this, "UseGFAL", true, "flag for auto gfal data access" };
56  Gaudi::Property<bool> m_quarantine{ this, "QuarantineFiles", true,
57  "if unaccessible files should be quarantines in job" };
58  Gaudi::Property<int> m_ageLimit{ this, "AgeLimit", 2, "age limit" };
60  this, "DisablePFNWarning", false,
61  "if set to True, we will not report when a file is opened by its physical name" };
62 
69  StatusCode connectDataIO( int typ, IoType rw, CSTR fn, CSTR technology, bool keep, Connection* con );
71  StatusCode error( CSTR msg, bool rethrow );
72  StatusCode establishConnection( Connection* con );
73 
75 
76  public:
78  using extends::extends;
79 
81  StatusCode initialize() override;
82 
84  StatusCode finalize() override;
85 
87  StatusCode connectRead( bool keep_open, Connection* ioDesc ) override;
89  StatusCode connectWrite( Connection* con, IoType mode = Connection::CREATE, CSTR doctype = "UNKNOWN" ) override;
91  StatusCode disconnect( Connection* ioDesc ) override;
93  Connection* connection( const std::string& dsn ) const override;
95  Connections connections( const IInterface* owner ) const override;
97  StatusCode read( Connection* ioDesc, void* const data, size_t len ) override;
99  StatusCode write( Connection* con, const void* data, int len ) override;
101  long long int seek( Connection* ioDesc, long long int where, int origin ) override;
102  };
103 } // End namespace Gaudi
104 #endif // GAUDIUTILS_IODATAMANAGER_H
Gaudi::IODataManager::Entry
Definition: IODataManager.h:42
std::string
STL class.
Gaudi::IODataManager::Entry::connection
IDataConnection * connection
Definition: IODataManager.h:45
Gaudi::IODataManager::m_quarantine
Gaudi::Property< bool > m_quarantine
Definition: IODataManager.h:56
Gaudi::IDataConnection
Definition: IIODataManager.h:34
Gaudi::IODataManager::connections
Connections connections(const IInterface *owner) const override
Get connection by owner instance (0=ALL)
Definition: IODataManager.cpp:89
Gaudi::IODataManager::connectRead
StatusCode connectRead(bool keep_open, Connection *ioDesc) override
Open data stream in read mode.
Definition: IODataManager.cpp:99
Gaudi::IODataManager::CSTR
const std::string & CSTR
Definition: IODataManager.h:41
Gaudi::IODataManager::m_useGFAL
Gaudi::Property< bool > m_useGFAL
Definition: IODataManager.h:55
Gaudi::IODataManager::establishConnection
StatusCode establishConnection(Connection *con)
Definition: IODataManager.cpp:210
Gaudi::IODataManager::connectWrite
StatusCode connectWrite(Connection *con, IoType mode=Connection::CREATE, CSTR doctype="UNKNOWN") override
Open data stream in write mode.
Definition: IODataManager.cpp:108
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
Gaudi::IODataManager::Entry::keepOpen
bool keepOpen
Definition: IODataManager.h:46
IIODataManager.h
Gaudi::IODataManager::error
StatusCode error(CSTR msg, bool rethrow)
Small routine to issue exceptions.
Definition: IODataManager.cpp:81
Gaudi::IODataManager::m_ageLimit
Gaudi::Property< int > m_ageLimit
Definition: IODataManager.h:58
Gaudi::IODataManager::m_connectionMap
ConnectionMap m_connectionMap
Map with I/O descriptors.
Definition: IODataManager.h:64
StatusCode
Definition: StatusCode.h:65
Gaudi::IODataManager::connection
Connection * connection(const std::string &dsn) const override
Retrieve known connection.
Definition: IODataManager.cpp:203
Gaudi::IODataManager::read
StatusCode read(Connection *ioDesc, void *const data, size_t len) override
Read raw byte buffer from input stream.
Definition: IODataManager.cpp:115
Gaudi::IODataManager::initialize
StatusCode initialize() override
IService implementation: initialize the service.
Definition: IODataManager.cpp:52
SmartIF
Definition: IConverter.h:25
Gaudi::IODataManager::finalize
StatusCode finalize() override
IService implementation: finalize the service.
Definition: IODataManager.cpp:75
Gaudi::IODataManager::m_catalogSvcName
Gaudi::Property< std::string > m_catalogSvcName
Definition: IODataManager.h:53
std::map< std::string, Entry * >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
Gaudi::IODataManager::write
StatusCode write(Connection *con, const void *data, int len) override
Write raw byte buffer to output stream.
Definition: IODataManager.cpp:120
Gaudi::IODataManager::m_catalog
SmartIF< IFileCatalog > m_catalog
Reference to file catalog.
Definition: IODataManager.h:66
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Gaudi::IODataManager::Entry::type
std::string type
Definition: IODataManager.h:43
Gaudi::IODataManager::disconnect
StatusCode disconnect(Connection *ioDesc) override
Release data stream.
Definition: IODataManager.cpp:129
Service.h
Gaudi::IODataManager::reconnect
StatusCode reconnect(Entry *e)
Definition: IODataManager.cpp:166
Gaudi::IODataManager::seek
long long int seek(Connection *ioDesc, long long int where, int origin) override
Seek on the file described by ioDesc. Arguments as in ::seek()
Definition: IODataManager.cpp:125
Gaudi::IODataManager::m_fidMap
FidMap m_fidMap
Map of FID to PFN.
Definition: IODataManager.h:68
Io::CREATE
@ CREATE
Definition: IFileMgr.h:41
IInterface
Definition: IInterface.h:239
Gaudi::IODataManager
Definition: IODataManager.h:39
Gaudi::IODataManager::FidMap
std::map< std::string, std::string > FidMap
Definition: IODataManager.h:51
Gaudi::IODataManager::Entry::Entry
Entry(CSTR tech, bool k, IoType iot, IDataConnection *con)
Definition: IODataManager.h:47
Gaudi::IODataManager::m_disablePFNWarning
Gaudi::Property< bool > m_disablePFNWarning
Definition: IODataManager.h:59
IIncidentSvc
Definition: IIncidentSvc.h:33
Gaudi::IODataManager::ConnectionMap
std::map< std::string, Entry * > ConnectionMap
Definition: IODataManager.h:50
Gaudi::IODataManager::Entry::ioType
IoType ioType
Definition: IODataManager.h:44
Gaudi::Property< std::string >
Gaudi::IODataManager::m_incSvc
SmartIF< IIncidentSvc > m_incSvc
Definition: IODataManager.h:74
Gaudi::IODataManager::connectDataIO
StatusCode connectDataIO(int typ, IoType rw, CSTR fn, CSTR technology, bool keep, Connection *con)
Definition: IODataManager.cpp:229