TDataSetManagerFile.h

Go to the documentation of this file.
00001 // @(#)root/proof:$Id: TDataSetManagerFile.h 33357 2010-05-04 06:56:18Z 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_TDataSetManagerFile
00013 #define ROOT_TDataSetManagerFile
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TDataSetManagerFile                                             //
00018 //                                                                      //
00019 // Implementation of TDataSetManager handling datasets from root   //
00020 // files under a specific directory path                                //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TDataSetManager
00025 #include "TDataSetManager.h"
00026 #endif
00027 
00028 const char* const kDataSet_LocalCache   = "dataset.cache"; // default cache subdirectory
00029 const char* const kDataSet_DataSetList  = "dataset.list";  // file with info about all datasets
00030 const char* const kDataSet_LockLocation = "lock.location"; // location of the lock file
00031 
00032 class TDataSetManagerFile : public TDataSetManager {
00033 
00034 private:
00035    TString fDataSetDir;        // Location of datasets
00036    TString fMSSUrl;            // URL for the Mass Storage System
00037    TString fStageOpts;         // Option string to be used in issuing staging requests
00038    TString fDataSetLockFile;   // Dataset lock file
00039    Int_t   fLockFileTimeLimit; // Limit in seconds after a lock automatically expires
00040    TString fListFile;          // File to check repository updates
00041    Bool_t  fIsRemote;          // True if the repository is remote
00042    Bool_t  fUseCache;          // True if the cache is used for browsing remote repositories
00043    TString fLocalCacheDir;     // Local cache when the repository is remote
00044    Int_t   fCacheUpdatePeriod; // Period for checking for new updated information
00045 
00046    // Local cache handling
00047    void    InitLocalCache();
00048    Int_t   CheckLocalCache(const char *group, const char *user, const char *dsName = "ls", UInt_t option = 0);
00049 
00050 protected:
00051    const char *GetDataSetPath(const char *group, const char *user, const char *dsName);
00052    const char *GetDataSetPath(const char *group, const char *user, const char *dsName,
00053                               TString &md5path, Bool_t local = kFALSE);
00054    void   Init();
00055    Bool_t BrowseDataSets(const char *group, const char *user, const char *dsName,
00056                          UInt_t option, TObject *target);
00057 
00058    Bool_t RemoveDataSet(const char *group, const char *user, const char *dsName);
00059    Bool_t ExistsDataSet(const char *group, const char *user, const char *dsName);
00060 
00061    Int_t  ScanDataSet(const char *group, const char *user, const char *dsName, UInt_t option = kReopen | kDebug);
00062 
00063    Int_t  ChecksumDataSet(const char *path, const char *md5path, TString &checksum);
00064 
00065    Int_t  CreateLsFile(const char *group, const char *user, Long_t &mtime, TString &checksum);
00066    Int_t  FillLsDataSet(const char *group, const char *user, const char *dsName, TList *out, UInt_t option);
00067 
00068    void UpdateUsedSpace();
00069 
00070 public:
00071    TDataSetManagerFile() : TDataSetManager(0, 0, 0) { }
00072    TDataSetManagerFile(const char *group, const char *user, const char *ins);
00073    TDataSetManagerFile(const char *ins);
00074    virtual ~TDataSetManagerFile() { }
00075 
00076    void             ParseInitOpts(const char *opts);
00077 
00078    Int_t            ClearCache(const char *uri = 0);
00079    TFileCollection *GetDataSet(const char *uri, const char *srv = 0);
00080    TMap            *GetDataSets(const char *uri, UInt_t option = TDataSetManager::kExport);
00081    Bool_t           ExistsDataSet(const char *uri);
00082    Bool_t           RemoveDataSet(const char *uri);
00083 
00084    Int_t            RegisterDataSet(const char *uri, TFileCollection *dataSet, const char *opt);
00085    Int_t            ScanDataSet(const char *uri, UInt_t option = kReopen | kDebug);
00086    Int_t            NotifyUpdate(const char *group, const char *user,
00087                                  const char *dspath, Long_t mtime, const char *checksum = 0);
00088    Int_t            ShowCache(const char *uri = 0);
00089 
00090    // These should / could be private but they are used directly by the external daemon
00091    TFileCollection *GetDataSet(const char *group, const char *user, const char *dsName,
00092                                UInt_t option = 0, TMD5 **checksum = 0);
00093    TMap            *GetDataSets(const char *group, const char *user, const char *dsName = 0,
00094                                 UInt_t option = 0);
00095    const char      *GetMSSUrl() const { return fMSSUrl; }
00096    const char      *GetStageOpts() const { return fStageOpts; }
00097    Int_t            WriteDataSet(const char *group, const char *user, const char *dsName,
00098                                  TFileCollection *dataset, UInt_t option = 0, TMD5 *checksum = 0);
00099 
00100    ClassDef(TDataSetManagerFile, 0) // DataSet manager for files
00101 };
00102 
00103 #endif

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