49 :
TNamed(
name, title), fList(nullptr), fMetaDataList(nullptr), fDefaultTree(),
50 fTotalSize(0), fNFiles(0), fNStagedFiles(0), fNCorruptFiles(0)
82 Warning(
"Add",
"file: '%s' already in the list - ignoring",
83 info->GetCurrentUrl()->GetUrl());
134 if (!
line.IsWhitespace() && !
line.BeginsWith(
"#")) {
136 if (
all || nn >=
ff) {
147 Error(
"AddFromFile",
"unable to open file %s (%s)",
textfile,
fn.Data());
167 Error(
"Add",
"input dir undefined");
190 Error(
"Add",
"directory %s cannot be opened",
236 if (!(
hl->FindObject(
fi->GetUUID()->AsString()))) {
239 fi->SetName(
fi->GetUUID()->AsString());
248 Info(
"RemoveDuplicates",
"%d duplicates found and removed",
nr);
284 if (
li->IsEmpty())
return 0;
291 Error(
"Add",
"attempt to add object of class: %s to a %s",
292 o->ClassName(),
this->ClassName());
407 TPMERegexp re(
"(^|;| )filter:([SsCc]+)( |;|$)", 4);
408 if (re.Match(
option) == 4) {
414 Printf(
"TFileCollection %s - %s contains: %lld files with a size of"
415 " %lld bytes, %.1f %% staged - default tree name: '%s'",
420 Printf(
"The files contain the following trees:");
433 Printf(
"The collection contains the following files:");
462 Printf(
"\033[1m #. SC | Entries | Size | URL\033[m");
476 if ( ((s &&
bS) || (!s &&
bs)) && ((
c &&
bC) || (!
c &&
bc)) ) {
481 if (
meta) entries =
meta->GetEntries();
489 Printf(
"\033[1m%4u.\033[m %c%c | %-7s | %6.1lf %s | %s",
491 (s ?
'S' :
's'), (
c ?
'C' :
'c'),
492 ((entries > 0) ?
Form(
"% 7d", entries) :
"n.a."),
497 while ((
url =
info->NextUrl())) {
508 Printf(
">> There are \033[1m%u\033[m file(s) in dataset: "
509 "\033[1m%u (%5.1f%%)\033[m matched your criteria (%s)",
514 Printf(
">> Total size : \033[1m%.1f %s\033[m",
sz, um.
Data());
516 Printf(
">> Corrupted (C) : \033[1m%5.1f %%\033[m",
521 Printf(
">> No files in dataset");
525 Printf(
">> Default tree : \033[1m%s\033[m",
536 static const char *
ums[] = {
"byt",
"KiB",
"MiB",
"GiB",
"TiB" };
624 if (!tree || !*tree) {
725 if (
meta->GetEntries() > 99999999) {
738 const char *unit[4] = {
"kB",
"MB",
"GB",
"TB"};
742 while (
xsz > 1024 && k < 3) {
777 Info(
"GetFilesOnServer",
"server undefined - do nothing");
783 Info(
"GetFilesOnServer",
"the list is empty - do nothing");
794 Info(
"GetFilesOnServer",
"searching for files on server: '%s' (input: '%s')",
805 fc->SetTitle(title.
Data());
817 if ((
xu =
fi->FindByUrl(
srv.Data()))) {
820 fi->GetUUID() ?
fi->GetUUID()->AsString() :
nullptr,
821 fi->GetMD5() ?
fi->GetMD5()->AsString() :
nullptr);
822 if (
fi->GetMetaDataList()) {
832 Info(
"GetFilesOnServer",
"adding: %s",
xu->GetUrl());
838 if (
fc->GetList()->GetSize() <= 0) {
841 Info(
"GetFilesOnServer",
"dataset '%s' has no files on server: '%s' (searched for: '%s')",
871 Info(
"GetFilesPerServer",
"the list is empty - do nothing");
883 while (
srvs.Tokenize(s,
from,
",")) {
912 key.
Form(
"%s://%s",
xurl->GetProtocol(),
xurl->GetHostFQDN());
917 }
else if (
excl &&
xurl->GetPort() > 0) {
926 TPair *ent =
nullptr;
936 fc->SetTitle(title.
Data());
943 Info(
"GetFilesPerServer",
"found server: '%s' (fc: %p)", key.
Data(),
fc);
950 fi->GetUUID() ?
fi->GetUUID()->AsString() :
nullptr,
951 fi->GetMD5() ?
fi->GetMD5()->AsString() :
nullptr);
952 if (
fi->GetMetaDataList()) {
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t bytes
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Bool_t R_ISREG(Int_t mode)
R__EXTERN TSystem * gSystem
Collection abstract base class.
virtual Int_t GetEntries() const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
void Print(Option_t *option="") const override
Default print for collections, calls Print(option, 1).
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Class that contains a list of TFileInfo's and accumulated meta data information about its entries.
Bool_t AddMetaData(TObject *meta)
Add's a meta data object to the file collection object.
TFileCollection * GetStagedSubset()
Creates a subset of the files that have the kStaged & !kCorrupted bit set.
TMap * GetFilesPerServer(const char *exclude=nullptr, Bool_t curronly=kFALSE)
Return a map of TFileCollections with the files on each data server, excluding servers in the comma-s...
TObjString * ExportInfo(const char *name=nullptr, Int_t popt=0)
Export the relevant info as a string; use 'name' as collection name, if defined, else use GetName().
Int_t RemoveDuplicates()
Remove duplicates based on the UUID, typically after a verification.
Int_t Update(Long64_t avgsize=-1)
Update accumulated information about the elements of the collection (e.g.
TFileCollection(const TFileCollection &)=delete
Long64_t GetTotalEntries(const char *tree) const
Returns the number of entries for the specified tree (retrieved from meta data).
void SetBitAll(UInt_t f)
Set the bit for all TFileInfos.
void Sort(Bool_t useindex=kFALSE)
Sort the collection.
void SetAnchor(const char *anchor)
Calls TUrl::SetAnchor() for all URLs contained in all TFileInfos.
void ResetBitAll(UInt_t f)
Reset the bit for all TFileInfos.
Float_t GetStagedPercentage() const
void FormatSize(Long64_t bytes, TString &um, Double_t &size) const
Format size.
void SetDefaultMetaData(const char *meta)
Moves the indicated meta data in the first position, so that it becomes effectively the default.
virtual ~TFileCollection()
Cleanup.
Long64_t GetNFiles() const
Long64_t GetTotalSize() const
void RemoveMetaData(const char *meta=nullptr)
Removes the indicated meta data object in all TFileInfos and this object If no name is given all meta...
Long64_t Merge(TCollection *list)
Merge all TFileCollection objects in li into this TFileCollection object.
Int_t AddFromFile(const char *file, Int_t nfiles=-1, Int_t firstfile=1)
Add file names contained in the specified text file.
void Print(Option_t *option="") const override
Prints the contents of the TFileCollection.
const char * GetDefaultTreeName() const
Returns the tree set with SetDefaultTreeName if set Returns the name of the first tree in the meta da...
Float_t GetCorruptedPercentage() const
Int_t Add(TFileInfo *info)
Add TFileInfo to the collection.
void PrintDetailed(TString &showOnly) const
Print detailed.
TFileCollection * GetFilesOnServer(const char *server)
Return the subset of files served by 'server'.
TFileInfoMeta * GetMetaData(const char *meta=nullptr) const
Returns the meta data object with the specified meta name.
Class describing a generic file including meta information.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
TObject * Remove(TObject *obj) override
Remove object from the list.
TObject * FindObject(const char *name) const override
Find object using its name.
void Clear(Option_t *option="") override
Remove all objects from the list.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
void AddFirst(TObject *obj) override
Add object at the beginning of the list.
virtual void Sort(Bool_t order=kSortAscending)
Sort linked list.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
Collectable string class.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Class used by TMap to store (key,value) pairs.
Regular expression class.
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
This class represents a RFC 3986 compatible URI.
const TString GetPort() const
Bool_t SetUri(const TString &uri)
Parse URI and set the member variables accordingly, returns kTRUE if URI validates,...
const TString GetScheme() const
This class represents a WWW compatible URL.
const char * GetHostFQDN() const
Return fully qualified domain name of url host.