ATLAS Offline Software
Loading...
Searching...
No Matches
IFileCatalog.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef APR_IFILECATALOG_H
6#define APR_IFILECATALOG_H
7
8#include "GaudiUtils/IFileCatalog.h"
9#include "GaudiUtils/IFileCatalogMgr.h"
10#include "GaudiKernel/SmartIF.h"
11
13#include "GaudiKernel/IMessageSvc.h"
14
15#include <iostream>
16
17namespace pool {
18
19 namespace FileCatalog {
20 typedef std::string FileID;
21 }
22
23 class IFileCatalog : public AthMessaging {
24 public:
25
26 typedef Gaudi::IFileCatalog::Files Files;
27 typedef Gaudi::IFileCatalog::Strings Strings;
28 typedef Gaudi::IFileCatalogMgr::Catalogs Catalogs;
29
30
33
34 // ------------------------------ Catalog interface
35
37 std::string createFID() const;
38
39 void connect() { /* not doing anything in Gaudi FC */ }
40 void disconnect() { /* not doing anything in Gaudi FC */ }
42 const std::string& connectInfo() const { return m_fc->connectInfo(); }
43
45 void start() { init(); }
47 void init() { m_fc->init(); }
49 void commit() { m_fc->commit(); }
51 void rollback() { m_fc->rollback(); }
53 bool readOnly() const { return m_fc->readOnly(); }
55 bool dirty() const { return m_fc->dirty(); }
56
58 void getFIDs( Strings& fids ) const { m_fc->getFID(fids); }
59
61 void getLFNs( const std::string& fid, Files& files ) const { m_fc->getLFN(fid, files); }
62
64 void getPFNs( const std::string& fid, Files& files ) const { m_fc->getPFN(fid, files); }
65
67 void getFirstPFN( const std::string& fid, std::string& pfn, std::string& tech ) const;
68
70 void lookupFileByPFN( const std::string& pfn, std::string& fid, std::string& tech ) const;
71
73 bool existsPFN( const std::string& pfn ) const { return m_fc->existsPFN(pfn); }
74
76 std::string lookupPFN( const std::string& pfn ) const { return m_fc->lookupPFN(pfn); }
77
79 // bool existsLFN( const std::string& lfn ) const = 0;
80
82 void lookupFileByLFN( const std::string& lfn, std::string& fid ) const { fid = lookupLFN(lfn); }
83 std::string lookupLFN( const std::string& lfn ) const { return m_fc->lookupLFN(lfn); }
84
86 // bool existsFID( const std::string& fid ) const = 0;
87
89 void deleteFID( const std::string& FileID ) { m_fc->deleteFID(FileID); }
90
92 void deletePFN( const std::string& pfn ) { m_fc->deletePFN(pfn); }
93
95 void registerPFN( const std::string& pfn, const std::string& ftype, std::string& fid );
96
98 void renamePFN( const std::string& pfn, const std::string& newpfn ) { m_fc->renamePFN(pfn, newpfn); }
99
101 void addReplicaPFN( const std::string& pfn, const std::string& replica_pfn );
102
104 void addReplicaFID( const std::string& fid,
105 const std::string& replica_pfn,
106 const std::string& replica_tech = "ROOT_All" );
107
109 // NOTE! this method requires FID! (and not PFN)
110 void registerLFN( const std::string& fid, const std::string& lfn ) const { m_fc->registerLFN(fid, lfn ); }
111
112
113 // ------------------------- Catalog Manager interface
114
116 void addReadCatalog( const std::string& connect ) { addCatalog(connect); }
117 void addCatalog( const std::string& connect );
118
120 //void addCatalog( Gaudi::IFileCatalog* cat ) { m_mgr->addCatalog(cat); }
121
123 void removeCatalog( const std::string& connect ) { m_mgr->removeCatalog(connect); }
124
126 //void removeCatalog( const Gaudi::IFileCatalog* cat ) { m_mgr->removeCatalog(cat); }
128 Catalogs& catalogs() { return m_mgr->catalogs(); }
130 const Catalogs& catalogs() const { return m_mgr->catalogs(); }
132 //Gaudi::IFileCatalog* writeCatalog( const std::string& fid = "" ) const { return m_mgr->writeCatalog(fid); }
134 //void setWriteCatalog( Gaudi::IFileCatalog* cat ) { m_mgr->setWriteCatalog(cat); }
136 void setWriteCatalog( const std::string& connect );
137
138
139 protected:
140 SmartIF<Gaudi::IFileCatalogMgr> m_mgr;
141 SmartIF<Gaudi::IFileCatalog> m_fc;
142 };
143
144}
145
146#endif
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
void start()
redirect to init() for Gaudi FC
void commit()
Save catalog to file.
void addReadCatalog(const std::string &connect)
Add new catalog identified by name to the existing ones.
void getPFNs(const std::string &fid, Files &files) const
Dump all PFNames of the catalog and their attributes associate to the FileID.
void lookupFileByPFN(const std::string &pfn, std::string &fid, std::string &tech) const
Get FID and filetype for a given PFN.
void deletePFN(const std::string &pfn)
Delete PFN from the catalog (delete entire FID entry if it was the last PFN)
void getFIDs(Strings &fids) const
Get all FIDs.
SmartIF< Gaudi::IFileCatalog > m_fc
bool existsPFN(const std::string &pfn) const
Return the status of a PFName.
std::string createFID() const
Create file identifier using UUID mechanism.
void getFirstPFN(const std::string &fid, std::string &pfn, std::string &tech) const
Get the first PFN + filetype for the given FID.
SmartIF< Gaudi::IFileCatalogMgr > m_mgr
Gaudi::IFileCatalog::Strings Strings
Gaudi::IFileCatalog::Files Files
void registerLFN(const std::string &fid, const std::string &lfn) const
Create a Node for a FileID and DOM Node of the LFN with all the attributes.
Gaudi::IFileCatalogMgr::Catalogs Catalogs
void removeCatalog(const std::string &connect)
Add new catalog identified by reference to the existing ones.
void addCatalog(const std::string &connect)
void init()
Parse the DOM tree of the XML catalog.
Catalogs & catalogs()
Remove catalog identified by reference from the existing ones.
void rollback()
Save catalog to file.
void renamePFN(const std::string &pfn, const std::string &newpfn)
Rename PFN.
const std::string & connectInfo() const
Get the connect string.
void registerPFN(const std::string &pfn, const std::string &ftype, std::string &fid)
Register PFN, assign new FID if not given.
void setWriteCatalog(const std::string &connect)
Access to the (first) writable file catalog.
std::string lookupLFN(const std::string &lfn) const
void getLFNs(const std::string &fid, Files &files) const
Get all logical names for a given FID. Return pairs <LFN,FID>
bool readOnly() const
Check if the catalog is read-only.
const Catalogs & catalogs() const
Access catalog container (CONST)
void addReplicaPFN(const std::string &pfn, const std::string &replica_pfn)
adding replica to an existing PFN
bool dirty() const
Check if the catalog should be updated.
std::string lookupPFN(const std::string &pfn) const
Lookup file identifier by physical file name.
void addReplicaFID(const std::string &fid, const std::string &replica_pfn, const std::string &replica_tech="ROOT_All")
adding replica to an existing FID
void lookupFileByLFN(const std::string &lfn, std::string &fid) const
Return the status of a LFName.
void deleteFID(const std::string &FileID)
Return the status of a FileID.
std::vector< std::string > files
file names and file pointers
Definition hcg.cxx:50
std::string FileID
pool namespace
Definition libname.h:15
std::string FileID