10 #ifndef __KVDATAREPOSITORY_H
11 #define __KVDATAREPOSITORY_H
20 #include "KVUniqueNameList.h"
21 #include "KVDataRepositoryImpl.h"
152 template<
typename... Strings>
162 template<
typename ExistCheck,
typename MakeDir>
164 template<
typename ExistCheck,
typename MakeDir,
typename... Strings>
178 template<
typename... Paths>
182 auto tmp = pc.get_full_path(paths...);
187 template<
typename... Paths>
191 auto tmp = pc.get_full_path(paths...);
196 template<
typename... Paths>
200 auto tmp = pc.get_full_path(paths...);
207 std::unique_ptr<KVDataRepositoryImpl>
_impl;
209 template<
typename... Paths>
212 auto check_path = [&](
TString &
p) {
215 return _impl->check_path_exists(
p);
224 pc.ensure_full_path_exists(check_path, mkdir, path1, paths...);
238 return _impl->GetType();
241 template<
typename... Paths>
251 template<
typename... Paths>
261 template<
typename... Paths>
268 template<
typename... Paths>
282 template<
typename... Paths>
291 if (
_impl->look_for_files_downloaded_to_temp_dir()) {
297 template<
typename... Paths>
319 template<
typename... Paths>
332 template<
typename... Paths>
340 _impl->copy_file_from(path, destination);
343 template<
typename... Paths>
355 auto status =
_impl->copy_file_to(source, path);
358 _impl->Chmod(path, 0664);
361 Error(
"CopyFileToRepository",
"Problem copying file %s to repository (status=%d)",
362 source.
Data(), status);
366 template<
typename... Paths>
377 std::cout <<
"CreateNewFile : " <<
filename << std::endl;
386 template<
typename... Paths>
400 std::cout << std::endl <<
"Copying file " << CommitFileName <<
" to repository" << std::endl;
408 template<
typename... Paths>
419 template<
typename... Paths>
428 std::cout <<
"Deleting file from repository: " <<
filename << std::endl;
431 "Are you sure you want to delete this file permanently ? (y/n)"
437 std::cout <<
"File not deleted" << std::endl;
441 _impl->delete_file(path);
443 template<
typename... Paths>
454 if (
_impl->look_for_files_downloaded_to_temp_dir()) {
461 return open_file(path);
463 template<
typename... Paths>
468 auto open_file = [](
const TString &
f) {
509 #ifdef __CCIN2P3_RFIO
510 #include "TRFIOFile.h"
511 class KVRFIOSystem :
public TRFIOSystem {
513 KVRFIOSystem(): TRFIOSystem() { };
514 virtual ~KVRFIOSystem() { };
516 Int_t Unlink(
const char* path);
#define ClassDef(name, id)
#define ClassDefOverride(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
void AssignAndDelete(TString &target, char *tobedeleted)
R__EXTERN TSystem * gSystem
Base class for KaliVeda framework.
void Error(const char *method, const char *msgfmt,...) const override
colourised errors (red) !
Base class for managing repositories of data.
TString GetFullPathToTransferFile(const TString &filename, const Paths &... paths) const
void DeleteFile(const TString &filename, Bool_t confirm, const Paths &... paths) const
const Char_t * GetType() const override
Bool_t CheckSubdirExists(const TString &path1, const Paths &... paths) const
TString GetRepositoryPath(const Paths &... paths) const
void CopyFileFromRepository(const TString &filename, const TString &destination, const Paths &... paths) const
KVUniqueNameList GetDirectoryListing(const Paths &... paths) const
TString GetFileTransferUser() const
returns user name used for remote file transfer
void MakeSubdirectory(const TString &path1, const Paths &... paths) const
std::unique_ptr< KVDataRepositoryImpl > _impl
TString GetFileTransferServer() const
returns server url used for remote file transfer
std::optional< FileStat_t > GetFileInfo(const TString &filename, const Paths &... paths) const
TString get_path_with_arbitrary_root(const TString &arb_root, const Paths &... paths) const
TString GetFileTransferType() const
returns protocol used for remote file transfer
void SetFullPath(TString &path, const TString &protocol)
TFile * OpenROOTFile(const TString &filename, const Paths &... paths)
Bool_t CheckFileStatus(const TString &filename, const Paths &... paths) const
TString GetFullPathToOpenFile(const TString &filename, const Paths &... paths) const
void SetCanWrite(Bool_t yes=kTRUE)
void ReadWithXrootd(const TString &server, const TString &rootdir)
TString GetFileTransferExec() const
returns full path to executable used for remote file transfer
KVDataRepository()
Default constructor.
TObject * OpenFile(const TString &filename, const std::function< TObject *(const TString &)> &open_file, const Paths &... paths)
void CreateAllNeededSubdirectories(const TString &path1, const Paths &... paths) const
void set_impl_backend(const TString &impl_type)
void CreateAllNeededSubdirectories() const
TString get_path_with_read_root(const Paths &... paths) const
void Print(Option_t *opt="") const override
Print info on repository.
TString get_path_with_access_root(const Paths &... paths) const
void CommitFile(TFile *file, const Paths &... paths)
TString GetRootDirectory() const
returns root directory of data repository (fLocalrootdir)
TFile * CreateNewFile(const TString &filename, const Paths &... paths) const
int CopyFileToRepository(const TString &filename, const TString &source, const Paths &... paths) const
Optimised list in which named objects can only be placed once.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
virtual char * ConcatFileName(const char *dir, const char *name)
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
virtual char * ExpandPathName(const char *path)
virtual int Unlink(const char *name)
virtual const char * TempDirectory() const
TString get_full_path(const TString &path, const Strings &... others)
TString get_full_path() const
void ensure_full_path_exists(ExistCheck ec, MakeDir md, const TString &path, const Strings &... others)
void ensure_full_path_exists(ExistCheck, MakeDir) const
PathConcatenator(const TString &_root)