TDataSetManager.h

Go to the documentation of this file.
00001 // @(#)root/proof:$Id: TDataSetManager.h 33447 2010-05-10 13:26:51Z ganis $
00002 // Author: Jan Fiete Grosse-Oetringhaus, 08.08.07
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TDataSetManager
00013 #define ROOT_TDataSetManager
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TDataSetManager                                                 //
00018 //                                                                      //
00019 // This class contains functions to handle datasets in PROOF            //
00020 // It is the layer between TProofServ and the file system that stores   //
00021 // the datasets.                                                        //
00022 //                                                                      //
00023 //////////////////////////////////////////////////////////////////////////
00024 
00025 #ifndef ROOT_TObject
00026 #include "TObject.h"
00027 #endif
00028 #ifndef ROOT_TString
00029 #include "TString.h"
00030 #endif
00031 #ifndef ROOT_TMap
00032 #include "TMap.h"
00033 #endif
00034 #ifndef ROOT_TUri
00035 #include "TUri.h"
00036 #endif
00037 
00038 
00039 class TFileCollection;
00040 class TFileInfo;
00041 class TMD5;
00042 class TUrl;
00043 class TVirtualMonitoringWriter;
00044 
00045 
00046 class TDataSetManager : public TObject {
00047 
00048 private:
00049    TDataSetManager(const TDataSetManager&);             // not implemented
00050    TDataSetManager& operator=(const TDataSetManager&);  // not implemented
00051 
00052 protected:
00053    TString  fGroup;         // Group to which the owner of this session belongs
00054    TString  fUser;          // Owner of the session
00055    TString  fCommonUser;    // User that stores the COMMON datasets
00056    TString  fCommonGroup;   // Group that stores the COMMON datasets
00057 
00058    TUri     fBase;          // Base URI used to parse dataset names
00059 
00060    TMap     fGroupQuota;    // Group quotas (read from config file)
00061    TMap     fGroupUsed;     // <group> --> <used bytes> (TParameter)
00062    TMap     fUserUsed;      // <group> --> <map of users> --> <value>
00063 
00064    Long64_t fAvgFileSize;   // Average file size to be used to estimate the dataset size (in MB)
00065 
00066    Int_t    fNTouchedFiles; // Number of files touched in the last ScanDataSet operation
00067    Int_t    fNOpenedFiles;  // Number of files opened in the last ScanDataSet operation
00068    Int_t    fNDisappearedFiles; // Number of files disappared in the last ScanDataSet operation
00069 
00070    TString  fGroupConfigFile;  // Path to the group config file
00071    Long_t   fMTimeGroupConfig; // Last modification of the group config file
00072 
00073    static TString fgCommonDataSetTag;  // Name for common datasets, default: COMMON
00074 
00075    static TList *fgDataSetSrvMaps; // List of TPair(TRegexp, TObjString) for mapping server coordinates
00076                                   // for dataset files (init from DataSet.SrvMap)
00077 
00078    virtual TMap *GetGroupUsedMap() { return &fGroupUsed; }
00079    virtual TMap *GetUserUsedMap() { return &fUserUsed; }
00080    Int_t    GetNTouchedFiles() const { return fNTouchedFiles; }
00081    Int_t    GetNOpenedFiles() const { return fNOpenedFiles; }
00082    Int_t    GetNDisapparedFiles() const { return fNDisappearedFiles; }
00083    void     GetQuota(const char *group, const char *user, const char *dsName, TFileCollection *dataset);
00084    void     PrintDataSet(TFileCollection *fc, Int_t popt = 0);
00085    void     PrintUsedSpace();
00086    Bool_t   ReadGroupConfig(const char *cf = 0);
00087    virtual void UpdateUsedSpace();
00088 
00089    static Long64_t ToBytes(const char *size = 0);
00090 
00091 public:
00092    enum EDataSetStatusBits {
00093       kCheckQuota    = BIT(15),   // quota checking enabled
00094       kAllowRegister = BIT(16),   // allow registration of a new dataset
00095       kAllowVerify   = BIT(17),   // allow verification of a dataset (requires registration permit)
00096       kTrustInfo     = BIT(18),   // during registration, trust the available information provided by the user
00097       kIsSandbox     = BIT(19),   // dataset dir is in the user sandbox (simplified naming)
00098       kUseCache      = BIT(20),   // force the usage of cache
00099       kDoNotUseCache = BIT(21)    // disable the cache
00100    };
00101 
00102    enum EDataSetWorkOpts { // General (bits 1-8)
00103                            kDebug = 0x1, kShowDefault = 0x2, kPrint = 0x4, kExport = 0x8,
00104                            kQuotaUpdate = 0x10, kSetDefaultTree = 0x20, kForceScan = 0x40,
00105                            kNoHeaderPrint = 0x80,
00106                            // File-based specific (bits 9-16)
00107                            kReopen = 0x100, kTouch = 0x200, kMaxFiles = 0x400, kReadShort = 0x800,
00108                            kFileMustExist = 0x1000,
00109                            kNoAction = 0x2000, kLocateOnly = 0x4000, kStageOnly = 0x8000,
00110                            // Auxilliary bits (bits 17-)
00111                            kNoCacheUpdate = 0x10000, kRefreshLs = 0x20000, kList = 0x40000,
00112                            kAllFiles = 0x80000, kStagedFiles = 0x100000, kNoStagedCheck = 0x200000
00113                            };
00114 
00115    TDataSetManager(const char *group = 0, const char *user = 0, const char *options = 0);
00116    virtual ~TDataSetManager();
00117 
00118    virtual Int_t            ClearCache(const char *uri);
00119    virtual Long64_t         GetAvgFileSize() const { return fAvgFileSize; }
00120    virtual TFileCollection *GetDataSet(const char *uri, const char *server = 0);
00121    virtual TMap            *GetDataSets(const char *uri, UInt_t /*option*/ = TDataSetManager::kExport);
00122    virtual TMap            *GetSubDataSets(const char *uri, const char *excludeservers);
00123 
00124    virtual Long64_t         GetGroupQuota(const char *group);
00125    virtual TMap            *GetGroupQuotaMap() { return &fGroupQuota; }
00126    virtual Long64_t         GetGroupUsed(const char *group);
00127    virtual Bool_t           ExistsDataSet(const char *uri);
00128    virtual void             MonitorUsedSpace(TVirtualMonitoringWriter *monitoring);
00129    virtual Int_t            NotifyUpdate(const char *group = 0, const char *user = 0,
00130                                          const char *dspath = 0, Long_t mtime = 0, const char *checksum = 0);
00131    Bool_t                   ParseUri(const char *uri, TString *dsGroup = 0, TString *dsUser = 0,
00132                                      TString *dsName = 0, TString *dsTree = 0,
00133                                      Bool_t onlyCurrent = kFALSE, Bool_t wildcards = kFALSE);
00134    virtual void             ParseInitOpts(const char *opts);
00135    virtual Bool_t           RemoveDataSet(const char *uri);
00136    virtual Int_t            RegisterDataSet(const char *uri, TFileCollection *dataSet, const char *opt);
00137    Int_t                    ScanDataSet(const char *uri, const char *opt);
00138    virtual Int_t            ScanDataSet(const char *uri, UInt_t option = kReopen | kDebug);
00139    void                     SetScanCounters(Int_t t = -1, Int_t o = -1, Int_t d = -1);
00140    virtual Int_t            ShowCache(const char *uri);
00141    virtual void             ShowQuota(const char *opt);
00142 
00143    virtual void             ShowDataSets(const char *uri = "*", const char *opt = "");
00144 
00145    static TString           CreateUri(const char *dsGroup = 0, const char *dsUser = 0,
00146                                       const char *dsName = 0, const char *dsTree = 0);
00147    static Bool_t            CheckDataSetSrvMaps(TUrl *furl, TString &fn, TList *srvmaplist = 0);
00148    static TList            *GetDataSetSrvMaps();
00149    static TList            *ParseDataSetSrvMaps(const TString &srvmaps);
00150    static Int_t             ScanDataSet(TFileCollection *dataset, Int_t fopt, Int_t sopt = 0, Int_t ropt = 0,
00151                                         Bool_t dbg = kFALSE,
00152                                         Int_t *touched = 0, Int_t *opened = 0, Int_t *disappeared = 0,
00153                                         TList *flist = 0, Long64_t avgsz = -1, const char *mss = 0,
00154                                         Int_t maxfiles = -1, const char *stageopts = 0);
00155    static Int_t             ScanFile(TFileInfo *fileinfo, Bool_t notify);
00156    static Int_t             FillMetaData(TFileInfo *fi, TDirectory *d, const char *rdir = "/");
00157 
00158    ClassDef(TDataSetManager, 0)  // Abstract data set manager class
00159 };
00160 
00161 #endif

Generated on Tue Jul 5 14:26:43 2011 for ROOT_528-00b_version by  doxygen 1.5.1