ROOT  6.06/09
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 #ifndef ROOT_TDataSetManager
25 #include "TDataSetManager.h"
26 #endif
27 
28 const char* const kDataSet_LocalCache = "dataset.cache"; // default cache subdirectory
29 const char* const kDataSet_DataSetList = "dataset.list"; // file with info about all datasets
30 const char* const kDataSet_LockLocation = "lock.location"; // location of the lock file
31 
33 
34 private:
35  TString fDataSetDir; // Location of datasets
36  TString fMSSUrl; // URL for the Mass Storage System
37  TString fStageOpts; // Option string to be used in issuing staging requests
38  TString fDataSetLockFile; // Dataset lock file
39  Int_t fLockFileTimeLimit; // Limit in seconds after a lock automatically expires
40  TString fListFile; // File to check repository updates
41  Bool_t fIsRemote; // True if the repository is remote
42  Bool_t fUseCache; // True if the cache is used for browsing remote repositories
43  TString fLocalCacheDir; // Local cache when the repository is remote
44  Int_t fCacheUpdatePeriod; // Period for checking for new updated information
45  Bool_t fOpenPerms; // True if file permissions must be open
46 
47  // Local cache handling
48  void InitLocalCache();
49  Int_t CheckLocalCache(const char *group, const char *user, const char *dsName = "ls", UInt_t option = 0);
50 
51 protected:
52  const char *GetDataSetPath(const char *group, const char *user, const char *dsName);
53  const char *GetDataSetPath(const char *group, const char *user, const char *dsName,
54  TString &md5path, Bool_t local = kFALSE);
55  void Init();
56  Bool_t BrowseDataSets(const char *group, const char *user, const char *dsName,
57  UInt_t option, TObject *target);
58 
59  Bool_t RemoveDataSet(const char *group, const char *user, const char *dsName);
60  Bool_t ExistsDataSet(const char *group, const char *user, const char *dsName);
61 
62  Int_t ScanDataSet(const char *group, const char *user, const char *dsName, UInt_t option = kReopen | kDebug);
63 
64  Int_t ChecksumDataSet(const char *path, const char *md5path, TString &checksum);
65 
66  Int_t CreateLsFile(const char *group, const char *user, Long_t &mtime, TString &checksum);
67  Int_t FillLsDataSet(const char *group, const char *user, const char *dsName, TList *out, UInt_t option);
68 
69  void UpdateUsedSpace();
70 
71 public:
73  TDataSetManagerFile(const char *group, const char *user, const char *ins);
74  TDataSetManagerFile(const char *ins);
75  virtual ~TDataSetManagerFile() { }
76 
77  void ParseInitOpts(const char *opts);
78 
79  Int_t ClearCache(const char *uri = 0);
80  TFileCollection *GetDataSet(const char *uri, const char *srv = 0);
81  TMap *GetDataSets(const char *uri, UInt_t option = TDataSetManager::kExport);
82  Bool_t ExistsDataSet(const char *uri);
83  Bool_t RemoveDataSet(const char *uri);
84 
85  Int_t RegisterDataSet(const char *uri, TFileCollection *dataSet, const char *opt);
86  Int_t ScanDataSet(const char *uri, UInt_t option = kReopen | kDebug);
87  Int_t NotifyUpdate(const char *group, const char *user,
88  const char *dspath, Long_t mtime, const char *checksum = 0);
89  Int_t ShowCache(const char *uri = 0);
90 
91  // These should / could be private but they are used directly by the external daemon
92  TFileCollection *GetDataSet(const char *group, const char *user, const char *dsName,
93  UInt_t option = 0, TMD5 **checksum = 0);
94  TMap *GetDataSets(const char *group, const char *user, const char *dsName = 0,
95  UInt_t option = 0);
96  const char *GetMSSUrl() const { return fMSSUrl; }
97  const char *GetStageOpts() const { return fStageOpts; }
98  Int_t WriteDataSet(const char *group, const char *user, const char *dsName,
99  TFileCollection *dataset, UInt_t option = 0, TMD5 *checksum = 0);
100  Long_t GetModTime(const char *uri);
101 
102  ClassDef(TDataSetManagerFile, 0) // DataSet manager for files
103 };
104 
105 #endif
Int_t RegisterDataSet(const char *uri, TFileCollection *dataSet, const char *opt)
Register a dataset, perfoming quota checkings and verification, if required.
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Long_t GetModTime(const char *uri)
Gets last dataset modification time.
const Bool_t kFALSE
Definition: Rtypes.h:92
const char *const kDataSet_LocalCache
void UpdateUsedSpace()
updates the used space maps
Int_t NotifyUpdate(const char *group, const char *user, const char *dspath, Long_t mtime, const char *checksum=0)
Save into the /kDataSet_DataSetList file the name of the updated or created or modified d...
const char *const kDataSet_DataSetList
Int_t ShowCache(const char *uri=0)
Show cached information matching uri.
#define ClassDef(name, id)
Definition: Rtypes.h:254
This code implements the MD5 message-digest algorithm.
Definition: TMD5.h:46
void ParseInitOpts(const char *opts)
Parse the input string and set the init bits accordingly Format is dir: [mss:] [...
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...
void Init()
Do the real inititialization.
char * out
Definition: TBase64.cxx:29
const char * GetMSSUrl() const
A doubly linked list.
Definition: TList.h:47
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'...
Bool_t RemoveDataSet(const char *group, const char *user, const char *dsName)
Removes the indicated dataset.
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.
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)
Int_t CreateLsFile(const char *group, const char *user, Long_t &mtime, TString &checksum)
Create or recreate the dataset lists for 'uri'.
TMap * GetDataSets(const char *uri, UInt_t option=TDataSetManager::kExport)
Returns all datasets for the and specified by .
Int_t WriteDataSet(const char *group, const char *user, const char *dsName, TFileCollection *dataset, UInt_t option=0, TMD5 *checksum=0)
Writes indicated dataset.
unsigned int UInt_t
Definition: RtypesCore.h:42
const char * GetDataSetPath(const char *group, const char *user, const char *dsName)
long Long_t
Definition: RtypesCore.h:50
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:44
Mother of all ROOT objects.
Definition: TObject.h:58
const char * GetStageOpts() const
Bool_t ExistsDataSet(const char *group, const char *user, const char *dsName)
Checks if the indicated dataset exits.
void InitLocalCache()
Init the local cache if required.
Class that contains a list of TFileInfo's and accumulated meta data information about its entries...
TFileCollection * GetDataSet(const char *uri, const char *srv=0)
Utility function used in various methods for user dataset upload.
Int_t ClearCache(const char *uri=0)
Clear cached information matching uri.
const char *const kDataSet_LockLocation
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, make the relevant updates Return 0 if OK, 1 if the dataset does not exists anymore, -1 on failure.