|
BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
|
Main Interface Class to work with the File Catalog of the experiment Throws runtime_exception if a critical error occurrs while the constructor Error Codes: -1 - sending command via CURL failed, -401 - unauthorized request, -403 - token invalid or expired, -404 - data not found, -409 - incorrect database request (e.g. More...
#include <FileCatalogue.h>
Public Member Functions | |
| FileCatalogue () | |
| virtual | ~FileCatalogue () |
| int | GetFileList (vector< unique_ptr< FileCondition > > file_conditions, vector< string > &filepaths) |
| Function for searching for file metadata in the File Catalog using specified conditions. | |
| int | GetFileInfo (string LFN, FileInfo &file_info) |
| Function to get metadata of the file stored at the given location. | |
| int | GetDirectoryInfo (string path, string &directory_info) |
| Function to get metadata of the directory at the given path. | |
| int | GetConsistencyCheckStatus () |
| Function to get status of the last successful consistency check. | |
| int | GetConsistencyCheckResults (int &eos_missing_count, int &fc_missing_count, vector< string > &eos_missing, vector< string > &fc_missing) |
| Function to get result of the last successful consistency check. | |
| int | GetFile (string LFN, string save_path) |
| Function to download file from the CICC (Dirac FC). | |
| int | GetPFNs (string LFN, vector< string > &PFNs) |
| Function to get file PFN (Physical File Name). | |
| int | AddFileInfo (string LFN, FileInfo file_metadata) |
| Function to add metadata for the file with specific LFN. | |
| int | AddFileInfo (string json_file_path) |
| Function to add file metadata to the File Catalog using input JSON file path. | |
| int | AddDirectoryInfo (string json_file_path) |
| Function to add directory metadata to the File Catalog using input JSON directory path. | |
| int | AddMetadataField (string field_name, string field_type, bool isDirectoryType=true) |
| Function to add new metadata field to the File Catalog. | |
| int | AddFile (string input_path, string LFN) |
| Function to add file to the File Catalog and upload to CICC. | |
| int | UpdateFileInfo (string LFN, FileInfo file_metadata) |
| Function to update metadata for the file with specific LFN. | |
| int | DeleteFileInfo (string LFN) |
| Function to delete metadata for the file with specific LFN. | |
| int | DeleteDirectoryInfo (string path) |
| Function to delete metadata for the directory at specific path. | |
| int | DeleteMetadataField (string metadatafield_name) |
| Function to delete metadata field from the File Catalog. | |
| int | DeleteFile (string LFN) |
| Function to delete file from the File Catalog and CICC. | |
| int | CheckFileInfo (string LFN) |
| Function to check metadata for the file with specific LFN. | |
| int | CheckFileExist (string LFN) |
| Function to check whether file exist or not. | |
| int | PrintFileInfo (string LFN) |
| Function to print metadata for the file stored at the given location. | |
| int | PrintMetadataFields () |
| Function to print current metadata fields. | |
| int | FileCatalogRequest (string rest_api_request, vector< string > &filepaths) |
| Function for searching for files matching specific metadata in the File Catalog using REST API request as an HTTP(s) string. | |
| int | FileCatalogConsistencyCheck () |
| Function to perform a consistency check in the File Catalog. | |
| int | FileCatalogStats (int &files_count, int &files_without_replicas, int &replicas_count, int &replicas_without_files) |
| Function to collect summary statistics on the File Catalog. | |
| void | SetVerbose (int verbose_level=0) |
| Setting Verbose level: 0 - only errors, 1 - normal output, 2 - detailed output, 3 - all with debug info. | |
| FileCatalogue () | |
| virtual | ~FileCatalogue () |
| int | GetFileList (vector< unique_ptr< FileCondition > > file_conditions, vector< string > &filepaths) |
| Function for searching for file metadata in the File Catalog using specified conditions. | |
| int | GetFileInfo (string LFN, FileInfo &file_info) |
| Function to get metadata of the file stored at the given location. | |
| int | GetDirectoryInfo (string path, string &directory_info) |
| Function to get metadata of the directory at the given path. | |
| int | GetConsistencyCheckStatus () |
| Function to get status of the last successful consistency check. | |
| int | GetConsistencyCheckResults (int &eos_missing_count, int &fc_missing_count, vector< string > &eos_missing, vector< string > &fc_missing) |
| Function to get result of the last successful consistency check. | |
| int | GetFile (string LFN, string save_path) |
| Function to download file from the CICC (Dirac FC). | |
| int | GetPFNs (string LFN, vector< string > &PFNs) |
| Function to get file PFN (Physical File Name). | |
| int | AddFileInfo (string LFN, FileInfo file_metadata) |
| Function to add metadata for the file with specific LFN. | |
| int | AddFileInfo (string json_file_path) |
| Function to add file metadata to the File Catalog using input JSON file path. | |
| int | AddDirectoryInfo (string json_file_path) |
| Function to add directory metadata to the File Catalog using input JSON directory path. | |
| int | AddMetadataField (string field_name, string field_type, bool isDirectoryType=true) |
| Function to add new metadata field to the File Catalog. | |
| int | AddFile (string input_path, string LFN) |
| Function to add file to the File Catalog and upload to CICC. | |
| int | UpdateFileInfo (string LFN, FileInfo file_metadata) |
| Function to update metadata for the file with specific LFN. | |
| int | DeleteFileInfo (string LFN) |
| Function to delete metadata for the file with specific LFN. | |
| int | DeleteDirectoryInfo (string path) |
| Function to delete metadata for the directory at specific path. | |
| int | DeleteMetadataField (string metadatafield_name) |
| Function to delete metadata field from the File Catalog. | |
| int | DeleteFile (string LFN) |
| Function to delete file from the File Catalog and CICC. | |
| int | CheckFileInfo (string LFN) |
| Function to check metadata for the file with specific LFN. | |
| int | CheckFileExist (string LFN) |
| Function to check whether file exist or not. | |
| int | PrintFileInfo (string LFN) |
| Function to print metadata for the file stored at the given location. | |
| int | PrintMetadataFields () |
| Function to print current metadata fields. | |
| int | FileCatalogRequest (string rest_api_request, vector< string > &filepaths) |
| Function for searching for files matching specific metadata in the File Catalog using REST API request as an HTTP(s) string. | |
| int | FileCatalogConsistencyCheck () |
| Function to perform a consistency check in the File Catalog. | |
| int | FileCatalogStats (int &files_count, int &files_without_replicas, int &replicas_count, int &replicas_without_files) |
| Function to collect summary statistics on the File Catalog. | |
| void | SetVerbose (int verbose_level=0) |
| Setting Verbose level: 0 - only errors, 1 - normal output, 2 - detailed output, 3 - all with debug info. | |
Private Member Functions | |
| string | performRequest (string conditions, string json_content, string qType) |
| Perfrom common curl read/write shenanigans. | |
| int | DownloadFile (string conditions, string savePath) |
| int | UploadFile (string conditions, string filepath) |
| string | performRequest (string conditions, string json_content, string qType) |
| Perfrom common curl read/write shenanigans. | |
| int | DownloadFile (string conditions, string savePath) |
| int | UploadFile (string conditions, string filepath) |
Private Attributes | |
| CURL * | curlInstance |
| string | ServiceUrl |
| string | ServiceAccount |
| int | VerboseLevel = 0 |
violating constraints), -422 - incorrect input request, -500 - internal server error, -503 - service unavaialble, -504 - gateway timeout
Definition at line 134 of file FileCatalogue.h.
| FileCatalogue::FileCatalogue | ( | ) |
Definition at line 104 of file FileCatalogue.cxx.
References curlInstance, FILE_API_HOST, FILE_API_NAME, FILE_API_PASSWORD, FILE_API_USERNAME, ServiceAccount, ServiceUrl, and FileInfo::Version.
|
virtual |
Definition at line 119 of file FileCatalogue.cxx.
References curlInstance.
| FileCatalogue::FileCatalogue | ( | ) |
|
virtual |
| int FileCatalogue::AddDirectoryInfo | ( | string | json_file_path | ) |
dir_path field for path to directory
| [in] | json_file_path | path of the JSON file containing a set of directory metadata to be stored |
Definition at line 486 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::AddDirectoryInfo | ( | string | json_file_path | ) |
dir_path field for path to directory
| [in] | json_file_path | path of the JSON file containing a set of directory metadata to be stored |
| int FileCatalogue::AddFile | ( | string | input_path, |
| string | LFN ) |
| [in] | input_path | local path to the file |
| [in] | LFN | LFN of the output file on the CICC and FileCatalogue |
Definition at line 508 of file FileCatalogue.cxx.
References UploadFile().
| int FileCatalogue::AddFile | ( | string | input_path, |
| string | LFN ) |
| [in] | input_path | local path to the file |
| [in] | LFN | LFN of the output file on the CICC and FileCatalogue |
| int FileCatalogue::AddFileInfo | ( | string | json_file_path | ) |
| [in] | json_file_path | path of the JSON file containing a set of file metadata to be stored |
Definition at line 463 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::AddFileInfo | ( | string | json_file_path | ) |
| [in] | json_file_path | path of the JSON file containing a set of file metadata to be stored |
| int FileCatalogue::AddFileInfo | ( | string | LFN, |
| FileInfo | file_metadata ) |
| [in] | LFN | Logical File Name of the file |
| [in] | file_metadata | 'FileInfo' object containing file metadata |
Definition at line 401 of file FileCatalogue.cxx.
References FileInfo::BeamParticle, FileInfo::EndDateTime, FileInfo::EndEvent, FileInfo::Energy, FileInfo::EventCount, FileInfo::FieldVoltage, FileInfo::FileSize, performRequest(), FileInfo::RunNumber, FileInfo::RunType, FileInfo::StartDateTime, FileInfo::StartEvent, and FileInfo::TargetParticle.
Referenced by UpdateFileInfo().
| int FileCatalogue::AddFileInfo | ( | string | LFN, |
| FileInfo | file_metadata ) |
| [in] | LFN | Logical File Name of the file |
| [in] | file_metadata | 'FileInfo' object containing file metadata |
| int FileCatalogue::AddMetadataField | ( | string | field_name, |
| string | field_type, | ||
| bool | isDirectoryType = true ) |
| [in] | field_name | metadata field name to be added |
| [in] | field_type | metadata field type (INT, DATETIME, FLOAT, VARCHAR(128)) |
| [in] | isDirectoryType | which type of field is needed. Directory or file |
Definition at line 427 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::AddMetadataField | ( | string | field_name, |
| string | field_type, | ||
| bool | isDirectoryType = true ) |
| [in] | field_name | metadata field name to be added |
| [in] | field_type | metadata field type (INT, DATETIME, FLOAT, VARCHAR(128)) |
| [in] | isDirectoryType | which type of field is needed. Directory or file |
| int FileCatalogue::CheckFileExist | ( | string | LFN | ) |
| [in] | LFN | Logical File Name of the file |
Definition at line 585 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::CheckFileExist | ( | string | LFN | ) |
| [in] | LFN | Logical File Name of the file |
| int FileCatalogue::CheckFileInfo | ( | string | LFN | ) |
| [in] | LFN | Logical File Name of the file |
Definition at line 570 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::CheckFileInfo | ( | string | LFN | ) |
| [in] | LFN | Logical File Name of the file |
| int FileCatalogue::DeleteDirectoryInfo | ( | string | path | ) |
| [in] | path | Path to the directory inside File Catalog |
Definition at line 533 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::DeleteDirectoryInfo | ( | string | path | ) |
| [in] | path | Path to the directory inside File Catalog |
| int FileCatalogue::DeleteFile | ( | string | LFN | ) |
| [in] | LFN | Logical File Name of the file |
Definition at line 558 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::DeleteFile | ( | string | LFN | ) |
| [in] | LFN | Logical File Name of the file |
| int FileCatalogue::DeleteFileInfo | ( | string | LFN | ) |
| [in] | LFN | Logical File Name of the file |
Definition at line 520 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::DeleteFileInfo | ( | string | LFN | ) |
| [in] | LFN | Logical File Name of the file |
| int FileCatalogue::DeleteMetadataField | ( | string | metadatafield_name | ) |
Either for file or directory
| [in] | metadatafield_name | Metadatafield name which you want to delete |
Definition at line 546 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::DeleteMetadataField | ( | string | metadatafield_name | ) |
Either for file or directory
| [in] | metadatafield_name | Metadatafield name which you want to delete |
|
private |
Definition at line 845 of file FileCatalogue.cxx.
References curlInstance, WriteData::error_detected, WriteData::error_msg, WriteData::file, FILE_API_PASSWORD, FILE_API_USERNAME, ServiceUrl, and WriteCallback().
Referenced by GetFile().
|
private |
| int FileCatalogue::FileCatalogConsistencyCheck | ( | ) |
Definition at line 683 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::FileCatalogConsistencyCheck | ( | ) |
| int FileCatalogue::FileCatalogRequest | ( | string | rest_api_request, |
| vector< string > & | filepaths ) |
| [in] | rest_api_request | String HTTP command representing a request using REST API format |
| [out] | filepaths | Vector of the filepath containing selected file metadata (empty if not found or some errors occured) |
Definition at line 655 of file FileCatalogue.cxx.
References exec().
| int FileCatalogue::FileCatalogRequest | ( | string | rest_api_request, |
| vector< string > & | filepaths ) |
| [in] | rest_api_request | String HTTP command representing a request using REST API format |
| [out] | filepaths | Vector of the filepath containing selected file metadata (empty if not found or some errors occured) |
| int FileCatalogue::FileCatalogStats | ( | int & | files_count, |
| int & | files_without_replicas, | ||
| int & | replicas_count, | ||
| int & | replicas_without_files ) |
| [out] | files_count | Number of files in the File Catalog |
| [out] | files_without_replicas | Number of files without replicas |
| [out] | replicas_count | Number of replicas in the File Catalog |
| [out] | replicas_without_files | Number of replicas without files in the File Catalog |
Definition at line 699 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::FileCatalogStats | ( | int & | files_count, |
| int & | files_without_replicas, | ||
| int & | replicas_count, | ||
| int & | replicas_without_files ) |
| [out] | files_count | Number of files in the File Catalog |
| [out] | files_without_replicas | Number of files without replicas |
| [out] | replicas_count | Number of replicas in the File Catalog |
| [out] | replicas_without_files | Number of replicas without files in the File Catalog |
| int FileCatalogue::GetConsistencyCheckResults | ( | int & | eos_missing_count, |
| int & | fc_missing_count, | ||
| vector< string > & | eos_missing, | ||
| vector< string > & | fc_missing ) |
Presumably up to hundreds megabytes of data
| [out] | eos_missing_count | number of files that exist in File Catalog but missing on EOS |
| [out] | fc_missing_count | number of files that exist in EOS but missing from File Catalog |
| [out] | eos_missing | paths to files (lfns) in File Catalog that are missing from EOS |
| [out] | fc_missing | paths to files in EOS that are missing from File Catalog |
Definition at line 319 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::GetConsistencyCheckResults | ( | int & | eos_missing_count, |
| int & | fc_missing_count, | ||
| vector< string > & | eos_missing, | ||
| vector< string > & | fc_missing ) |
Presumably up to hundreds megabytes of data
| [out] | eos_missing_count | number of files that exist in File Catalog but missing on EOS |
| [out] | fc_missing_count | number of files that exist in EOS but missing from File Catalog |
| [out] | eos_missing | paths to files (lfns) in File Catalog that are missing from EOS |
| [out] | fc_missing | paths to files in EOS that are missing from File Catalog |
| int FileCatalogue::GetConsistencyCheckStatus | ( | ) |
Date and ID.
Definition at line 307 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::GetConsistencyCheckStatus | ( | ) |
Date and ID.
| int FileCatalogue::GetDirectoryInfo | ( | string | path, |
| string & | directory_info ) |
| [in] | path | Path to the directory in the File Catalog |
| [out] | directory_info | String containing metadata fields and it's values |
Definition at line 285 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::GetDirectoryInfo | ( | string | path, |
| string & | directory_info ) |
| [in] | path | Path to the directory in the File Catalog |
| [out] | directory_info | String containing metadata fields and it's values |
| int FileCatalogue::GetFile | ( | string | LFN, |
| string | save_path ) |
| [in] | LFN | LFN of the downloaded file |
| [in] | save_path | path to place where you want to save it. locally or by xrootd URL |
Definition at line 353 of file FileCatalogue.cxx.
References DownloadFile(), and performRequest().
Referenced by get_file().
| int FileCatalogue::GetFile | ( | string | LFN, |
| string | save_path ) |
| [in] | LFN | LFN of the downloaded file |
| [in] | save_path | path to place where you want to save it. locally or by xrootd URL |
| int FileCatalogue::GetFileInfo | ( | string | LFN, |
| FileInfo & | file_info ) |
| [in] | LFN | Logical File Name of the file |
| [out] | file_info | FileInfo object containing file metadata |
Definition at line 227 of file FileCatalogue.cxx.
References FileInfo::BeamParticle, FileInfo::EndDateTime, FileInfo::EndEvent, FileInfo::Energy, FileInfo::EventCount, FileInfo::FieldVoltage, FileInfo::FileSize, performRequest(), FileInfo::PeriodNumber, FileInfo::RunNumber, FileInfo::RunType, FileInfo::StartDateTime, FileInfo::StartEvent, and FileInfo::TargetParticle.
Referenced by get_file_metadata().
| int FileCatalogue::GetFileInfo | ( | string | LFN, |
| FileInfo & | file_info ) |
| [in] | LFN | Logical File Name of the file |
| [out] | file_info | FileInfo object containing file metadata |
| int FileCatalogue::GetFileList | ( | vector< unique_ptr< FileCondition > > | file_conditions, |
| vector< string > & | filepaths ) |
| [in] | file_conditions | A set of conditions to specify criteria for file metadata search |
| [out] | filepaths | Vector of the filepaths to files containing selected file metadata (empty if not found or some errors occured |
Definition at line 135 of file FileCatalogue.cxx.
References FileCondition::kBeamParticle, FileCondition::kEndDateTime, FileCondition::kEndEvent, FileCondition::kEnergy, FileCondition::kEqual, FileCondition::kError, FileCondition::kEventCount, FileCondition::kFieldVoltage, FileCondition::kFileSize, FileCondition::kGreaterOrEqual, FileCondition::kLessOrEqual, FileCondition::kLike, FileCondition::kNotEqual, FileCondition::kPeriodNumber, FileCondition::kRunNumber, FileCondition::kRunType, FileCondition::kStartDateTime, FileCondition::kStartEvent, FileCondition::kTargetParticle, performRequest(), and ReplaceAll().
Referenced by get_file_list().
| int FileCatalogue::GetFileList | ( | vector< unique_ptr< FileCondition > > | file_conditions, |
| vector< string > & | filepaths ) |
| [in] | file_conditions | A set of conditions to specify criteria for file metadata search |
| [out] | filepaths | Vector of the filepaths to files containing selected file metadata (empty if not found or some errors occured |
| int FileCatalogue::GetPFNs | ( | string | LFN, |
| vector< string > & | PFNs ) |
| [in] | LFN | LFN of the file |
| [out] | PFNs | Vector of PFNs of the file |
Definition at line 372 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::GetPFNs | ( | string | LFN, |
| vector< string > & | PFNs ) |
| [in] | LFN | LFN of the file |
| [out] | PFNs | Vector of PFNs of the file |
|
private |
| [in] | conditions | String of conditions/path/commands which goes after URL when perfrorming API request |
| [in] | json_content | String containing json with request as append content |
| [in] | qType | type of request |
Definition at line 723 of file FileCatalogue.cxx.
References appendData(), curlInstance, FILE_API_PASSWORD, FILE_API_USERNAME, ServiceUrl, and VerboseLevel.
Referenced by AddDirectoryInfo(), AddFileInfo(), AddFileInfo(), AddMetadataField(), CheckFileExist(), CheckFileInfo(), DeleteDirectoryInfo(), DeleteFile(), DeleteFileInfo(), DeleteMetadataField(), FileCatalogConsistencyCheck(), FileCatalogStats(), GetConsistencyCheckResults(), GetConsistencyCheckStatus(), GetDirectoryInfo(), GetFile(), GetFileInfo(), GetFileList(), GetPFNs(), PrintFileInfo(), and PrintMetadataFields().
|
private |
| [in] | conditions | String of conditions/path/commands which goes after URL when perfrorming API request |
| [in] | json_content | String containing json with request as append content |
| [in] | qType | type of request |
| int FileCatalogue::PrintFileInfo | ( | string | LFN | ) |
| [in] | LFN | Logical File Name of the file |
Definition at line 600 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::PrintFileInfo | ( | string | LFN | ) |
| [in] | LFN | Logical File Name of the file |
| int FileCatalogue::PrintMetadataFields | ( | ) |
Definition at line 624 of file FileCatalogue.cxx.
References performRequest().
| int FileCatalogue::PrintMetadataFields | ( | ) |
|
inline |
| [in] | verbose_level | Verbose level for output information |
Definition at line 339 of file FileCatalogue.h.
References VerboseLevel.
|
inline |
| [in] | verbose_level | Verbose level for output information |
Definition at line 339 of file FileCatalogue.h.
References VerboseLevel.
| int FileCatalogue::UpdateFileInfo | ( | string | LFN, |
| FileInfo | file_metadata ) |
| [in] | LFN | Logical File Name of the file |
| [in] | file_metadata | 'FileInfo' object containing file metadata |
Definition at line 515 of file FileCatalogue.cxx.
References AddFileInfo().
| int FileCatalogue::UpdateFileInfo | ( | string | LFN, |
| FileInfo | file_metadata ) |
| [in] | LFN | Logical File Name of the file |
| [in] | file_metadata | 'FileInfo' object containing file metadata |
|
private |
Definition at line 908 of file FileCatalogue.cxx.
References appendData(), curlInstance, FILE_API_PASSWORD, FILE_API_USERNAME, progressCallback(), and ServiceUrl.
Referenced by AddFile().
|
private |
|
private |
Definition at line 342 of file FileCatalogue.h.
Referenced by FileCatalogue(), ~FileCatalogue(), DownloadFile(), performRequest(), and UploadFile().
|
private |
Definition at line 344 of file FileCatalogue.h.
Referenced by FileCatalogue().
|
private |
Definition at line 343 of file FileCatalogue.h.
Referenced by FileCatalogue(), DownloadFile(), performRequest(), and UploadFile().
|
private |
Definition at line 346 of file FileCatalogue.h.
Referenced by performRequest(), and SetVerbose().