This class provides an interface to the file (metadata) catalog.  
 More...
#include <FileCatalog.h>
|  | 
| typedef std::map< std::string, std::pair< std::string, FileMetaData > > | FileMap | 
|  | Map with file catalog content. 
 | 
|  | 
|  | 
| std::string | m_fileName | 
|  | Name of the file catalog file. 
 | 
|  | 
This class provides an interface to the file (metadata) catalog. 
Definition at line 24 of file FileCatalog.h.
◆ getMetaData()
  
  | 
        
          | bool getMetaData | ( | std::string & | fileName, |  
          |  |  | FileMetaData & | metaData |  
          |  | ) |  |  |  | virtual | 
 
Get the metadata of a file with given (logical) file name. 
- Parameters
- 
  
    | fileName | The (logical) name of the file. Will be set to the physical file name. |  | metaData | The meta data information of the file. |  
 
- Returns
- True if the file was found in the catalog. 
Definition at line 142 of file FileCatalog.cc.
  151     B2ERROR(
"Locking of file catalog " << 
m_fileName << 
" failed.");
 
  158     B2ERROR(
"Failed to read file catalog " << 
m_fileName);
 
  163   auto iEntry = fileMap.find(fileName);
 
  164   if (iEntry != fileMap.end()) {
 
  165     metaData = iEntry->second.second;
 
  166     if (!iEntry->second.first.empty()) fileName = iEntry->second.first;
 
  169   for (
const auto& entry : fileMap) {
 
  170     if (fileName.compare(entry.second.first) == 0) {
 
  171       metaData = entry.second.second;
 
std::map< std::string, std::pair< std::string, FileMetaData > > FileMap
Map with file catalog content.
std::string m_fileName
Name of the file catalog file.
bool readCatalog(FileMap &fileMap)
Read the file catalog from the local file.
Helper class for locking a file.
 
 
 
◆ getPhysicalFileName()
  
  | 
        
          | std::string getPhysicalFileName | ( | const std::string & | lfn | ) |  |  | virtual | 
 
Get the physical file name for the LFN. 
- Parameters
- 
  
    | lfn | The logical file name. |  
 
- Returns
- the physical file name or an empty string if the lfn is not in the catalog. 
Definition at line 180 of file FileCatalog.cc.
 
 
◆ Instance()
Static method to get a reference to the FileCatalog instance. 
- Returns
- A reference to an instance of this class. 
Definition at line 23 of file FileCatalog.cc.
 
 
◆ readCatalog()
Read the file catalog from the local file. 
- Parameters
- 
  
    | fileMap | The map of file catalog entries. |  
 
- Returns
- True if the catalog was read successfully. 
Definition at line 54 of file FileCatalog.cc.
 
 
◆ registerFile()
  
  | 
        
          | bool registerFile | ( | const std::string & | fileName, |  
          |  |  | FileMetaData & | metaData, |  
          |  |  | const std::string & | oldLFN = "" |  
          |  | ) |  |  |  | virtual | 
 
Register a file in the (local) file catalog. 
- Parameters
- 
  
    | fileName | The name of the file to be registered. |  | metaData | The meta data information of the file to be registered. Will be updated. |  | oldLFN | If not empty, update the file catalog: only register the file if the oldLFN is found in the catalog and if so, also remove any file with the old LFN from the catalog. |  
 
- Returns
- True if the registration succeeded. 
Definition at line 90 of file FileCatalog.cc.
 
 
◆ writeCatalog()
  
  | 
        
          | bool writeCatalog | ( | const FileMap & | fileMap | ) |  |  | private | 
 
Write the file catalog to the local file. 
- Parameters
- 
  
    | fileMap | The map of file catalog entries. |  
 
- Returns
- True if the catalog was written successfully. 
Definition at line 77 of file FileCatalog.cc.
 
 
The documentation for this class was generated from the following files: