12 #ifndef ROOT_TDataSetManager
13 #define ROOT_TDataSetManager
31 class TFileCollection;
35 class TVirtualMonitoringWriter;
38 class TDataSetManager :
public TObject {
41 TDataSetManager(
const TDataSetManager&);
42 TDataSetManager& operator=(
const TDataSetManager&);
56 Long64_t fAvgFileSize;
60 Int_t fNDisappearedFiles;
62 TString fGroupConfigFile;
63 Long_t fMTimeGroupConfig;
65 static TString fgCommonDataSetTag;
67 static TList *fgDataSetSrvMaps;
70 virtual TMap *GetGroupUsedMap() {
return &fGroupUsed; }
71 virtual TMap *GetUserUsedMap() {
return &fUserUsed; }
72 Int_t GetNTouchedFiles()
const {
return fNTouchedFiles; }
73 Int_t GetNOpenedFiles()
const {
return fNOpenedFiles; }
74 Int_t GetNDisapparedFiles()
const {
return fNDisappearedFiles; }
75 void GetQuota(
const char *group,
const char *user,
const char *dsName, TFileCollection *dataset);
76 void PrintDataSet(TFileCollection *fc, Int_t popt = 0);
77 void PrintUsedSpace();
78 Bool_t ReadGroupConfig(
const char *cf = 0);
79 virtual void UpdateUsedSpace();
81 static Long64_t ToBytes(
const char *size = 0);
84 enum EDataSetStatusBits {
85 kCheckQuota = BIT(15),
86 kAllowRegister = BIT(16),
87 kAllowVerify = BIT(17),
91 kDoNotUseCache = BIT(21)
94 enum EDataSetWorkOpts {
95 kDebug = 0x1, kShowDefault = 0x2, kPrint = 0x4, kExport = 0x8,
96 kQuotaUpdate = 0x10, kSetDefaultTree = 0x20, kForceScan = 0x40,
97 kNoHeaderPrint = 0x80,
99 kReopen = 0x100, kTouch = 0x200, kMaxFiles = 0x400, kReadShort = 0x800,
100 kFileMustExist = 0x1000,
101 kNoAction = 0x2000, kLocateOnly = 0x4000, kStageOnly = 0x8000,
103 kNoCacheUpdate = 0x10000, kRefreshLs = 0x20000, kList = 0x40000,
104 kAllFiles = 0x80000, kStagedFiles = 0x100000, kNoStagedCheck = 0x200000
107 TDataSetManager(
const char *group = 0,
const char *user = 0,
const char *options = 0);
108 virtual ~TDataSetManager();
110 virtual Int_t ClearCache(
const char *uri);
111 virtual Long64_t GetAvgFileSize()
const {
return fAvgFileSize; }
112 virtual TFileCollection *GetDataSet(
const char *uri,
const char *server = 0);
113 virtual TMap *GetDataSets(
const char *uri, UInt_t = TDataSetManager::kExport);
114 virtual TMap *GetSubDataSets(
const char *uri,
const char *excludeservers);
116 virtual Long64_t GetGroupQuota(
const char *group);
117 virtual TMap *GetGroupQuotaMap() {
return &fGroupQuota; }
118 virtual Long64_t GetGroupUsed(
const char *group);
119 virtual Bool_t ExistsDataSet(
const char *uri);
120 virtual void MonitorUsedSpace(TVirtualMonitoringWriter *monitoring);
121 virtual Int_t NotifyUpdate(
const char *group = 0,
const char *user = 0,
122 const char *dspath = 0, Long_t mtime = 0,
const char *checksum = 0);
123 Bool_t ParseUri(
const char *uri, TString *dsGroup = 0, TString *dsUser = 0,
124 TString *dsName = 0, TString *dsTree = 0,
125 Bool_t onlyCurrent = kFALSE, Bool_t wildcards = kFALSE);
126 virtual void ParseInitOpts(
const char *opts);
127 virtual Bool_t RemoveDataSet(
const char *uri);
128 virtual Int_t RegisterDataSet(
const char *uri, TFileCollection *dataSet,
const char *opt);
129 Int_t ScanDataSet(
const char *uri,
const char *opt);
130 virtual Int_t ScanDataSet(
const char *uri, UInt_t option = kReopen | kDebug);
131 void SetScanCounters(Int_t t = -1, Int_t o = -1, Int_t d = -1);
132 virtual Int_t ShowCache(
const char *uri);
133 virtual void ShowQuota(
const char *opt);
135 virtual void ShowDataSets(
const char *uri =
"*",
const char *opt =
"");
137 static TString CreateUri(
const char *dsGroup = 0,
const char *dsUser = 0,
138 const char *dsName = 0,
const char *dsTree = 0);
139 static Bool_t CheckDataSetSrvMaps(TUrl *furl, TString &fn, TList *srvmaplist = 0);
140 static TList *GetDataSetSrvMaps();
141 static TList *ParseDataSetSrvMaps(
const TString &srvmaps);
142 static Int_t ScanDataSet(TFileCollection *dataset, Int_t fopt, Int_t sopt = 0, Int_t ropt = 0,
144 Int_t *touched = 0, Int_t *opened = 0, Int_t *disappeared = 0,
145 TList *flist = 0, Long64_t avgsz = -1,
const char *mss = 0,
146 Int_t maxfiles = -1,
const char *stageopts = 0);
147 static Bool_t CheckStagedStatus(TFileInfo *fileInfo, Int_t fopt, Int_t maxfiles,
148 Int_t newstagedfiles, TFileStager* stager, Bool_t createStager,
149 Bool_t dbg, Bool_t &changed, Bool_t& touched,
150 Bool_t& disappeared);
151 static void ProcessFile(TFileInfo *fileInfo, Int_t sopt, Bool_t checkstg, Bool_t doall,
152 TFileStager* stager, Bool_t createStager,
const char* stageopts,
153 Bool_t dbg, Bool_t &changed, Bool_t& opened);
155 static Int_t ScanFile(TFileInfo *fileinfo, Bool_t notify);
156 static Int_t FillMetaData(TFileInfo *fi, TDirectory *d,
const char *rdir =
"/");
158 ClassDef(TDataSetManager, 0)