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;
32 virtual AliCDBEntry* GetEntry(const AliCDBId& queryId);
33 virtual AliCDBId* GetEntryId(const AliCDBId& queryId);
34 virtual TList* GetEntries(const AliCDBId& queryId);
35 virtual Bool_t PutEntry(AliCDBEntry* entry);
36 virtual TList* GetIdListFromFile(const char* fileName);
40 AliCDBGrid(const char *gridUrl, const char *user, const char* dbFolder,
41 const char *se, const char* cacheFolder, Bool_t operateDisconnected,
42 Long64_t cacheSize, Long_t cleanupInterval);
44 virtual ~AliCDBGrid();
46 AliCDBGrid(const AliCDBGrid& db);
47 AliCDBGrid& operator = (const AliCDBGrid& db);
49 Bool_t FilenameToId(TString& filename, AliCDBId& id);
51 Bool_t PrepareId(AliCDBId& id);
52 AliCDBId* GetId(const TObjArray& validFileIds, const AliCDBId& query);
53 AliCDBEntry* GetEntryFromFile(TString& filename, AliCDBId* dataId);
55 // TODO use AliEnTag classes!
56 Bool_t AddTag(TString& foldername, const char* tagname);
57 Bool_t TagFileId(TString& filename, const AliCDBId* id);
58 Bool_t TagFileMetaData(TString& filename, const AliCDBMetaData* md);
59 Bool_t TagShortLived(TString& filename, Bool_t value);
61 void MakeQueryFilter(Int_t firstRun, Int_t lastRun, const AliCDBMetaData* md, TString& result) const;
63 virtual void QueryValidFiles();
65 TString fGridUrl; // Grid Url ("alien://aliendb4.cern.ch:9000")
66 TString fUser; // User
67 TString fDBFolder; // path of the DB folder
68 TString fSE; // Storage Element
69 TString fCacheFolder; // local cache folder
70 Bool_t fOperateDisconnected; // Operate disconnected flag
71 Long64_t fCacheSize; // local cache size (in bytes)
72 Long_t fCleanupInterval; // local cache cleanup interval
74 ClassDef(AliCDBGrid, 0) // access class to a DataBase in an AliEn storage
77 /////////////////////////////////////////////////////////////////////
79 // class AliCDBGridFactory //
81 /////////////////////////////////////////////////////////////////////
83 class AliCDBGridFactory: public AliCDBStorageFactory {
87 virtual Bool_t Validate(const char* gridString);
88 virtual AliCDBParam* CreateParameter(const char* gridString);
89 virtual ~AliCDBGridFactory(){}
92 virtual AliCDBStorage* Create(const AliCDBParam* param);
94 ClassDef(AliCDBGridFactory, 0);
97 /////////////////////////////////////////////////////////////////////
99 // class AliCDBGridParam //
101 /////////////////////////////////////////////////////////////////////
103 class AliCDBGridParam: public AliCDBParam {
107 AliCDBGridParam(const char* gridUrl, const char* user,
108 const char* dbFolder, const char* se,
109 const char* cacheFolder, Bool_t operateDisconnected,
110 Long64_t cacheSize, Long_t cleanupInterval);
112 virtual ~AliCDBGridParam();
114 const TString& GridUrl() const {return fGridUrl;}
115 const TString& GetUser() const {return fUser;}
116 const TString& GetDBFolder() const {return fDBFolder;}
117 const TString& GetSE() const {return fSE;}
118 const TString& GetCacheFolder() const {return fCacheFolder;}
119 Bool_t GetOperateDisconnected() const {return fOperateDisconnected;}
120 Long64_t GetCacheSize() const {return fCacheSize;}
121 Long_t GetCleanupInterval() const {return fCleanupInterval;}
123 virtual AliCDBParam* CloneParam() const;
125 virtual ULong_t Hash() const;
126 virtual Bool_t IsEqual(const TObject* obj) const;
129 TString fGridUrl; // Grid url "Host:port"
130 TString fUser; // User
131 TString fDBFolder; // path of the DB folder
132 TString fSE; // Storage Element
133 TString fCacheFolder; // Cache folder
134 Bool_t fOperateDisconnected; // Operate disconnected flag
135 Long64_t fCacheSize; // local cache size (in bytes)
136 Long_t fCleanupInterval; // local cache cleanup interval
138 ClassDef(AliCDBGridParam, 0);