#ifndef ROOT_TDataSetManager
#define ROOT_TDataSetManager
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TMap
#include "TMap.h"
#endif
#ifndef ROOT_TUri
#include "TUri.h"
#endif
class TFileCollection;
class TFileInfo;
class TMD5;
class TUrl;
class TVirtualMonitoringWriter;
class TDataSetManager : public TObject {
private:
TDataSetManager(const TDataSetManager&);
TDataSetManager& operator=(const TDataSetManager&);
protected:
TString fGroup;
TString fUser;
TString fCommonUser;
TString fCommonGroup;
TUri fBase;
TMap fGroupQuota;
TMap fGroupUsed;
TMap fUserUsed;
Long64_t fAvgFileSize;
Int_t fNTouchedFiles;
Int_t fNOpenedFiles;
Int_t fNDisappearedFiles;
TString fGroupConfigFile;
Long_t fMTimeGroupConfig;
static TString fgCommonDataSetTag;
static TList *fgDataSetSrvMaps;
virtual TMap *GetGroupUsedMap() { return &fGroupUsed; }
virtual TMap *GetUserUsedMap() { return &fUserUsed; }
Int_t GetNTouchedFiles() const { return fNTouchedFiles; }
Int_t GetNOpenedFiles() const { return fNOpenedFiles; }
Int_t GetNDisapparedFiles() const { return fNDisappearedFiles; }
void GetQuota(const char *group, const char *user, const char *dsName, TFileCollection *dataset);
void PrintDataSet(TFileCollection *fc, Int_t popt = 0);
void PrintUsedSpace();
Bool_t ReadGroupConfig(const char *cf = 0);
virtual void UpdateUsedSpace();
static Long64_t ToBytes(const char *size = 0);
public:
enum EDataSetStatusBits {
kCheckQuota = BIT(15),
kAllowRegister = BIT(16),
kAllowVerify = BIT(17),
kTrustInfo = BIT(18),
kIsSandbox = BIT(19),
kUseCache = BIT(20),
kDoNotUseCache = BIT(21)
};
enum EDataSetWorkOpts {
kDebug = 0x1, kShowDefault = 0x2, kPrint = 0x4, kExport = 0x8,
kQuotaUpdate = 0x10, kSetDefaultTree = 0x20, kForceScan = 0x40,
kNoHeaderPrint = 0x80,
kReopen = 0x100, kTouch = 0x200, kMaxFiles = 0x400, kReadShort = 0x800,
kFileMustExist = 0x1000,
kNoAction = 0x2000, kLocateOnly = 0x4000, kStageOnly = 0x8000,
kNoCacheUpdate = 0x10000, kRefreshLs = 0x20000, kList = 0x40000,
kAllFiles = 0x80000, kStagedFiles = 0x100000, kNoStagedCheck = 0x200000
};
TDataSetManager(const char *group = 0, const char *user = 0, const char *options = 0);
virtual ~TDataSetManager();
virtual Int_t ClearCache(const char *uri);
virtual Long64_t GetAvgFileSize() const { return fAvgFileSize; }
virtual TFileCollection *GetDataSet(const char *uri, const char *server = 0);
virtual TMap *GetDataSets(const char *uri, UInt_t = TDataSetManager::kExport);
virtual TMap *GetSubDataSets(const char *uri, const char *excludeservers);
virtual Long64_t GetGroupQuota(const char *group);
virtual TMap *GetGroupQuotaMap() { return &fGroupQuota; }
virtual Long64_t GetGroupUsed(const char *group);
virtual Bool_t ExistsDataSet(const char *uri);
virtual void MonitorUsedSpace(TVirtualMonitoringWriter *monitoring);
virtual Int_t NotifyUpdate(const char *group = 0, const char *user = 0,
const char *dspath = 0, Long_t mtime = 0, const char *checksum = 0);
Bool_t ParseUri(const char *uri, TString *dsGroup = 0, TString *dsUser = 0,
TString *dsName = 0, TString *dsTree = 0,
Bool_t onlyCurrent = kFALSE, Bool_t wildcards = kFALSE);
virtual void ParseInitOpts(const char *opts);
virtual Bool_t RemoveDataSet(const char *uri);
virtual Int_t RegisterDataSet(const char *uri, TFileCollection *dataSet, const char *opt);
Int_t ScanDataSet(const char *uri, const char *opt);
virtual Int_t ScanDataSet(const char *uri, UInt_t option = kReopen | kDebug);
void SetScanCounters(Int_t t = -1, Int_t o = -1, Int_t d = -1);
virtual Int_t ShowCache(const char *uri);
virtual void ShowQuota(const char *opt);
virtual void ShowDataSets(const char *uri = "*", const char *opt = "");
static TString CreateUri(const char *dsGroup = 0, const char *dsUser = 0,
const char *dsName = 0, const char *dsTree = 0);
static Bool_t CheckDataSetSrvMaps(TUrl *furl, TString &fn, TList *srvmaplist = 0);
static TList *GetDataSetSrvMaps();
static TList *ParseDataSetSrvMaps(const TString &srvmaps);
static Int_t ScanDataSet(TFileCollection *dataset, Int_t fopt, Int_t sopt = 0, Int_t ropt = 0,
Bool_t dbg = kFALSE,
Int_t *touched = 0, Int_t *opened = 0, Int_t *disappeared = 0,
TList *flist = 0, Long64_t avgsz = -1, const char *mss = 0,
Int_t maxfiles = -1, const char *stageopts = 0);
static Int_t ScanFile(TFileInfo *fileinfo, Bool_t notify);
static Int_t FillMetaData(TFileInfo *fi, TDirectory *d, const char *rdir = "/");
ClassDef(TDataSetManager, 0)
};
#endif