4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 /////////////////////////////////////////////////////////////////////
10 // access class to a DataBase in an AliEn storage //
12 /////////////////////////////////////////////////////////////////////
14 #include "AliCDBStorage.h"
15 #include "AliCDBManager.h"
16 #include "AliCDBMetaData.h"
18 class AliCDBGrid: public AliCDBStorage {
19 friend class AliCDBGridFactory;
23 virtual Bool_t IsReadOnly() const {return kFALSE;}
24 virtual Bool_t HasSubVersion() const {return kFALSE;}
25 virtual Bool_t Contains(const char* path) const;
26 virtual Int_t GetLatestVersion(const char* path, Int_t run);
27 virtual Int_t GetLatestSubVersion(const char* path, Int_t run, Int_t version);
28 virtual Bool_t IdToFilename(const AliCDBId& id, TString& filename) const;
29 virtual void SetRetry(Int_t nretry, Int_t initsec);
33 virtual AliCDBEntry* GetEntry(const AliCDBId& queryId);
34 virtual AliCDBId* GetEntryId(const AliCDBId& queryId);
35 virtual TList* GetEntries(const AliCDBId& queryId);
36 virtual Bool_t PutEntry(AliCDBEntry* entry);
37 virtual TList* GetIdListFromFile(const char* fileName);
41 AliCDBGrid(const char *gridUrl, const char *user, const char* dbFolder,
42 const char *se, const char* cacheFolder, Bool_t operateDisconnected,
43 Long64_t cacheSize, Long_t cleanupInterval);
45 virtual ~AliCDBGrid();
47 AliCDBGrid(const AliCDBGrid& db);
48 AliCDBGrid& operator = (const AliCDBGrid& db);
50 Bool_t FilenameToId(TString& filename, AliCDBId& id);
52 Bool_t PrepareId(AliCDBId& id);
53 AliCDBId* GetId(const TObjArray& validFileIds, const AliCDBId& query);
54 AliCDBEntry* GetEntryFromFile(TString& filename, AliCDBId* dataId);
56 // TODO use AliEnTag classes!
57 Bool_t AddTag(TString& foldername, const char* tagname);
58 Bool_t TagFileId(TString& filename, const AliCDBId* id);
59 Bool_t TagFileMetaData(TString& filename, const AliCDBMetaData* md);
60 Bool_t TagShortLived(TString& filename, Bool_t value);
62 void MakeQueryFilter(Int_t firstRun, Int_t lastRun, const AliCDBMetaData* md, TString& result) const;
64 virtual void QueryValidFiles();
66 TString fGridUrl; // Grid Url ("alien://aliendb4.cern.ch:9000")
67 TString fUser; // User
68 TString fDBFolder; // path of the DB folder
69 TString fSE; // Storage Element
70 TString fCacheFolder; // local cache folder
71 Bool_t fOperateDisconnected; // Operate disconnected flag
72 Long64_t fCacheSize; // local cache size (in bytes)
73 Long_t fCleanupInterval; // local cache cleanup interval
75 ClassDef(AliCDBGrid, 0) // access class to a DataBase in an AliEn storage
78 /////////////////////////////////////////////////////////////////////
80 // class AliCDBGridFactory //
82 /////////////////////////////////////////////////////////////////////
84 class AliCDBGridFactory: public AliCDBStorageFactory {
88 virtual Bool_t Validate(const char* gridString);
89 virtual AliCDBParam* CreateParameter(const char* gridString);
90 virtual ~AliCDBGridFactory(){}
93 virtual AliCDBStorage* Create(const AliCDBParam* param);
95 ClassDef(AliCDBGridFactory, 0);
98 /////////////////////////////////////////////////////////////////////
100 // class AliCDBGridParam //
102 /////////////////////////////////////////////////////////////////////
104 class AliCDBGridParam: public AliCDBParam {
108 AliCDBGridParam(const char* gridUrl, const char* user,
109 const char* dbFolder, const char* se,
110 const char* cacheFolder, Bool_t operateDisconnected,
111 Long64_t cacheSize, Long_t cleanupInterval);
113 virtual ~AliCDBGridParam();
115 const TString& GridUrl() const {return fGridUrl;}
116 const TString& GetUser() const {return fUser;}
117 const TString& GetDBFolder() const {return fDBFolder;}
118 const TString& GetSE() const {return fSE;}
119 const TString& GetCacheFolder() const {return fCacheFolder;}
120 Bool_t GetOperateDisconnected() const {return fOperateDisconnected;}
121 Long64_t GetCacheSize() const {return fCacheSize;}
122 Long_t GetCleanupInterval() const {return fCleanupInterval;}
124 virtual AliCDBParam* CloneParam() const;
126 virtual ULong_t Hash() const;
127 virtual Bool_t IsEqual(const TObject* obj) const;
130 TString fGridUrl; // Grid url "Host:port"
131 TString fUser; // User
132 TString fDBFolder; // path of the DB folder
133 TString fSE; // Storage Element
134 TString fCacheFolder; // Cache folder
135 Bool_t fOperateDisconnected; // Operate disconnected flag
136 Long64_t fCacheSize; // local cache size (in bytes)
137 Long_t fCleanupInterval; // local cache cleanup interval
139 ClassDef(AliCDBGridParam, 0);