Logo ROOT  
Reference Guide
TDataSetManagerFile.h
Go to the documentation of this file.
1 // @(#)root/proof:$Id$
2 // Author: Jan Fiete Grosse-Oetringhaus, 08.08.07
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TDataSetManagerFile
13 #define ROOT_TDataSetManagerFile
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TDataSetManagerFile //
18 // //
19 // Implementation of TDataSetManager handling datasets from root //
20 // files under a specific directory path //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "TDataSetManager.h"
25 
26 const char* const kDataSet_LocalCache = "dataset.cache"; // default cache subdirectory
27 const char* const kDataSet_DataSetList = "dataset.list"; // file with info about all datasets
28 const char* const kDataSet_LockLocation = "lock.location"; // location of the lock file
29 
31 
32 private:
33  TString fDataSetDir; // Location of datasets
34  TString fMSSUrl; // URL for the Mass Storage System
35  TString fStageOpts; // Option string to be used in issuing staging requests
36  TString fDataSetLockFile; // Dataset lock file
37  Int_t fLockFileTimeLimit; // Limit in seconds after a lock automatically expires
38  TString fListFile; // File to check repository updates
39  Bool_t fIsRemote; // True if the repository is remote
40  Bool_t fUseCache; // True if the cache is used for browsing remote repositories
41  TString fLocalCacheDir; // Local cache when the repository is remote
42  Int_t fCacheUpdatePeriod; // Period for checking for new updated information
43  Bool_t fOpenPerms; // True if file permissions must be open
44 
45  // Local cache handling
46  void InitLocalCache();
47  Int_t CheckLocalCache(const char *group, const char *user, const char *dsName = "ls", UInt_t option = 0);
48 
49 protected:
50  const char *GetDataSetPath(const char *group, const char *user, const char *dsName);
51  const char *GetDataSetPath(const char *group, const char *user, const char *dsName,
52  TString &md5path, Bool_t local = kFALSE);
53  void Init();
54  Bool_t BrowseDataSets(const char *group, const char *user, const char *dsName,
55  UInt_t option, TObject *target);
56 
57  Bool_t RemoveDataSet(const char *group, const char *user, const char *dsName);
58  Bool_t ExistsDataSet(const char *group, const char *user, const char *dsName);
59 
60  Int_t ScanDataSet(const char *group, const char *user, const char *dsName, UInt_t option = kReopen | kDebug);
61 
62  Int_t ChecksumDataSet(const char *path, const char *md5path, TString &checksum);
63 
64  Int_t CreateLsFile(const char *group, const char *user, Long_t &mtime, TString &checksum);
65  Int_t FillLsDataSet(const char *group, const char *user, const char *dsName, TList *out, UInt_t option);
66 
67  void UpdateUsedSpace();
68 
69 public:
71  TDataSetManagerFile(const char *group, const char *user, const char *ins);
72  TDataSetManagerFile(const char *ins);
73  virtual ~TDataSetManagerFile() { }
74 
75  void ParseInitOpts(const char *opts);
76 
77  Int_t ClearCache(const char *uri = 0);
78  TFileCollection *GetDataSet(const char *uri, const char *srv = 0);
79  TMap *GetDataSets(const char *uri, UInt_t option = TDataSetManager::kExport);
80  Bool_t ExistsDataSet(const char *uri);
81  Bool_t RemoveDataSet(const char *uri);
82 
83  Int_t RegisterDataSet(const char *uri, TFileCollection *dataSet, const char *opt);
84  Int_t ScanDataSet(const char *uri, UInt_t option = kReopen | kDebug);
85  Int_t NotifyUpdate(const char *group, const char *user,
86  const char *dspath, Long_t mtime, const char *checksum = 0);
87  Int_t ShowCache(const char *uri = 0);
88 
89  // These should / could be private but they are used directly by the external daemon
90  TFileCollection *GetDataSet(const char *group, const char *user, const char *dsName,
91  UInt_t option = 0, TMD5 **checksum = 0);
92  TMap *GetDataSets(const char *group, const char *user, const char *dsName = 0,
93  UInt_t option = 0);
94  const char *GetMSSUrl() const { return fMSSUrl; }
95  const char *GetStageOpts() const { return fStageOpts; }
96  Int_t WriteDataSet(const char *group, const char *user, const char *dsName,
97  TFileCollection *dataset, UInt_t option = 0, TMD5 *checksum = 0);
98  Long_t GetModTime(const char *uri);
99 
100  ClassDef(TDataSetManagerFile, 0) // DataSet manager for files
101 };
102 
103 #endif
TDataSetManager.h
TDataSetManagerFile::ScanDataSet
Int_t ScanDataSet(const char *group, const char *user, const char *dsName, UInt_t option=kReopen|kDebug)
See documentation of ScanDataSet(TFileCollection *dataset, UInt_t option)
Definition: TDataSetManagerFile.cxx:1783
TDataSetManager::kReopen
@ kReopen
Definition: TDataSetManager.h:99
TDataSetManagerFile
Definition: TDataSetManagerFile.h:30
TDataSetManagerFile::fOpenPerms
Bool_t fOpenPerms
Definition: TDataSetManagerFile.h:43
TDataSetManagerFile::fDataSetLockFile
TString fDataSetLockFile
Definition: TDataSetManagerFile.h:36
TDataSetManagerFile::ChecksumDataSet
Int_t ChecksumDataSet(const char *path, const char *md5path, TString &checksum)
Calculate the checksum of the indicated dataset at 'path' and save it to the appropriate file 'md5pat...
Definition: TDataSetManagerFile.cxx:1512
TDataSetManagerFile::UpdateUsedSpace
void UpdateUsedSpace()
updates the used space maps
Definition: TDataSetManagerFile.cxx:1959
TDataSetManagerFile::fDataSetDir
TString fDataSetDir
Definition: TDataSetManagerFile.h:33
TDataSetManagerFile::ExistsDataSet
Bool_t ExistsDataSet(const char *group, const char *user, const char *dsName)
Checks if the indicated dataset exits.
Definition: TDataSetManagerFile.cxx:1576
TDataSetManagerFile::InitLocalCache
void InitLocalCache()
Init the local cache if required.
Definition: TDataSetManagerFile.cxx:234
kDataSet_DataSetList
const char *const kDataSet_DataSetList
Definition: TDataSetManagerFile.h:27
Int_t
int Int_t
Definition: RtypesCore.h:45
TDataSetManagerFile::WriteDataSet
Int_t WriteDataSet(const char *group, const char *user, const char *dsName, TFileCollection *dataset, UInt_t option=0, TMD5 *checksum=0)
Writes indicated dataset.
Definition: TDataSetManagerFile.cxx:1394
TDataSetManagerFile::ClearCache
Int_t ClearCache(const char *uri=0)
Clear cached information matching uri.
Definition: TDataSetManagerFile.cxx:1253
kDataSet_LocalCache
const char *const kDataSet_LocalCache
Definition: TDataSetManagerFile.h:26
TDataSetManagerFile::Init
void Init()
Do the real inititialization.
Definition: TDataSetManagerFile.cxx:93
TDataSetManager
Definition: TDataSetManager.h:38
TString
Basic string class.
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TDataSetManagerFile::RemoveDataSet
Bool_t RemoveDataSet(const char *group, const char *user, const char *dsName)
Removes the indicated dataset.
Definition: TDataSetManagerFile.cxx:1544
TDataSetManagerFile::BrowseDataSets
Bool_t BrowseDataSets(const char *group, const char *user, const char *dsName, UInt_t option, TObject *target)
Adds the dataset in the folder of group, user to the list in target.
Definition: TDataSetManagerFile.cxx:577
bool
TDataSetManagerFile::CreateLsFile
Int_t CreateLsFile(const char *group, const char *user, Long_t &mtime, TString &checksum)
Create or recreate the dataset lists for 'uri'.
Definition: TDataSetManagerFile.cxx:474
TDataSetManagerFile::fLocalCacheDir
TString fLocalCacheDir
Definition: TDataSetManagerFile.h:41
TDataSetManager::kExport
@ kExport
Definition: TDataSetManager.h:95
group
Definition: TWinNTSystem.h:59
TDataSetManagerFile::TDataSetManagerFile
TDataSetManagerFile()
Definition: TDataSetManagerFile.h:70
TDataSetManagerFile::CheckLocalCache
Int_t CheckLocalCache(const char *group, const char *user, const char *dsName="ls", UInt_t option=0)
Check if the local cache information for group, user, dsName is up-to-date If not,...
Definition: TDataSetManagerFile.cxx:1085
TDataSetManagerFile::GetDataSet
TFileCollection * GetDataSet(const char *uri, const char *srv=0)
Utility function used in various methods for user dataset upload.
Definition: TDataSetManagerFile.cxx:1874
TDataSetManagerFile::fUseCache
Bool_t fUseCache
Definition: TDataSetManagerFile.h:40
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
Long_t
long Long_t
Definition: RtypesCore.h:54
TDataSetManagerFile::RegisterDataSet
Int_t RegisterDataSet(const char *uri, TFileCollection *dataSet, const char *opt)
Register a dataset, perfoming quota checkings and verification, if required.
Definition: TDataSetManagerFile.cxx:1598
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TMD5
This code implements the MD5 message-digest algorithm.
Definition: TMD5.h:44
TDataSetManagerFile::ShowCache
Int_t ShowCache(const char *uri=0)
Show cached information matching uri.
Definition: TDataSetManagerFile.cxx:1319
TDataSetManagerFile::GetDataSets
TMap * GetDataSets(const char *uri, UInt_t option=TDataSetManager::kExport)
Returns all datasets for the <group> and <user> specified by <uri>.
Definition: TDataSetManagerFile.cxx:1859
unsigned int
TDataSetManagerFile::GetMSSUrl
const char * GetMSSUrl() const
Definition: TDataSetManagerFile.h:94
TDataSetManager::kDebug
@ kDebug
Definition: TDataSetManager.h:95
TDataSetManagerFile::GetStageOpts
const char * GetStageOpts() const
Definition: TDataSetManagerFile.h:95
TDataSetManagerFile::~TDataSetManagerFile
virtual ~TDataSetManagerFile()
Definition: TDataSetManagerFile.h:73
TDataSetManagerFile::NotifyUpdate
Int_t NotifyUpdate(const char *group, const char *user, const char *dspath, Long_t mtime, const char *checksum=0)
Save into the <datasetdir>/kDataSet_DataSetList file the name of the updated or created or modified d...
Definition: TDataSetManagerFile.cxx:382
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TDataSetManagerFile::FillLsDataSet
Int_t FillLsDataSet(const char *group, const char *user, const char *dsName, TList *out, UInt_t option)
Check for the 'ls.txt' for 'group' and 'user' and fill the path for the ls file in 'out'.
Definition: TDataSetManagerFile.cxx:943
TDataSetManagerFile::fListFile
TString fListFile
Definition: TDataSetManagerFile.h:38
TDataSetManagerFile::ParseInitOpts
void ParseInitOpts(const char *opts)
Parse the input string and set the init bits accordingly Format is dir:<datasetdir> [mss:<mss-url>] [...
Definition: TDataSetManagerFile.cxx:317
TDataSetManagerFile::fCacheUpdatePeriod
Int_t fCacheUpdatePeriod
Definition: TDataSetManagerFile.h:42
TDataSetManagerFile::fLockFileTimeLimit
Int_t fLockFileTimeLimit
Definition: TDataSetManagerFile.h:37
TDataSetManagerFile::GetModTime
Long_t GetModTime(const char *uri)
Gets last dataset modification time.
Definition: TDataSetManagerFile.cxx:1973
kDataSet_LockLocation
const char *const kDataSet_LockLocation
Definition: TDataSetManagerFile.h:28
TDataSetManagerFile::GetDataSetPath
const char * GetDataSetPath(const char *group, const char *user, const char *dsName)
TDataSetManagerFile::fMSSUrl
TString fMSSUrl
Definition: TDataSetManagerFile.h:34
TDataSetManagerFile::fStageOpts
TString fStageOpts
Definition: TDataSetManagerFile.h:35
TDataSetManagerFile::fIsRemote
Bool_t fIsRemote
Definition: TDataSetManagerFile.h:39
TList
A doubly linked list.
Definition: TList.h:44
int
TFileCollection
Class that contains a list of TFileInfo's and accumulated meta data information about its entries.
Definition: TFileCollection.h:39
TMap
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:40