]>
Commit | Line | Data |
---|---|---|
9e1ceb13 | 1 | #ifndef ALICDBGRID_H |
2 | #define ALICDBGRID_H | |
3 | ||
4 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | ///////////////////////////////////////////////////////////////////// | |
8 | // // | |
9 | // class AliCDBGrid // | |
b05400be | 10 | // access class to a DataBase in an AliEn storage // |
9e1ceb13 | 11 | // // |
12 | ///////////////////////////////////////////////////////////////////// | |
13 | ||
14 | #include "AliCDBStorage.h" | |
15 | #include "AliCDBManager.h" | |
6dc56e97 | 16 | #include "AliCDBMetaData.h" |
9e1ceb13 | 17 | |
18 | class AliCDBGrid: public AliCDBStorage { | |
5078a13f | 19 | friend class AliCDBGridFactory; |
9e1ceb13 | 20 | |
5078a13f | 21 | public: |
c5941d67 | 22 | |
5078a13f | 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 Bool_t IdToFilename(const AliCDBId& id, TString& filename) const; | |
27 | virtual void SetRetry(Int_t nretry, Int_t initsec); | |
28 | virtual void SetMirrorSEs(const char* mirrors) {fMirrorSEs=mirrors;} | |
29 | virtual const char* GetMirrorSEs() const {return fMirrorSEs;} | |
c3a7b59a | 30 | |
9e1ceb13 | 31 | |
5078a13f | 32 | protected: |
9e1ceb13 | 33 | |
5078a13f | 34 | virtual AliCDBEntry* GetEntry(const AliCDBId& queryId); |
35 | virtual AliCDBId* GetEntryId(const AliCDBId& queryId); | |
36 | virtual TList* GetEntries(const AliCDBId& queryId); | |
37 | virtual Bool_t PutEntry(AliCDBEntry* entry, const char* mirrors=""); | |
38 | virtual TList* GetIdListFromFile(const char* fileName); | |
c75fabed | 39 | |
5078a13f | 40 | private: |
9e1ceb13 | 41 | |
5078a13f | 42 | AliCDBGrid(const char *gridUrl, const char *user, const char* dbFolder, |
43 | const char *se, const char* cacheFolder, Bool_t operateDisconnected, | |
44 | Long64_t cacheSize, Long_t cleanupInterval); | |
9e1ceb13 | 45 | |
5078a13f | 46 | virtual ~AliCDBGrid(); |
9e1ceb13 | 47 | |
5078a13f | 48 | AliCDBGrid(const AliCDBGrid& db); |
49 | AliCDBGrid& operator = (const AliCDBGrid& db); | |
9e1ceb13 | 50 | |
5078a13f | 51 | Bool_t FilenameToId(TString& filename, AliCDBId& id); |
9e1ceb13 | 52 | |
5078a13f | 53 | Bool_t PrepareId(AliCDBId& id); |
54 | AliCDBId* GetId(const TObjArray& validFileIds, const AliCDBId& query); | |
55 | AliCDBEntry* GetEntryFromFile(TString& filename, AliCDBId* dataId); | |
67522875 | 56 | Bool_t PutInCvmfs(TString &fullFilename, TFile *cdbFile) const; |
9e1ceb13 | 57 | |
5078a13f | 58 | // TODO use AliEnTag classes! |
59 | Bool_t AddTag(TString& foldername, const char* tagname); | |
60 | Bool_t TagFileId(TString& filename, const AliCDBId* id); | |
61 | Bool_t TagFileMetaData(TString& filename, const AliCDBMetaData* md); | |
62 | Bool_t TagShortLived(TString& filename, Bool_t value); | |
62032124 | 63 | |
5078a13f | 64 | void MakeQueryFilter(Int_t firstRun, Int_t lastRun, const AliCDBMetaData* md, TString& result) const; |
9e1ceb13 | 65 | |
5078a13f | 66 | virtual void QueryValidFiles(); |
9e1ceb13 | 67 | |
5078a13f | 68 | TString fGridUrl; // Grid Url ("alien://aliendb4.cern.ch:9000") |
69 | TString fUser; // User | |
70 | TString fDBFolder; // path of the DB folder | |
71 | TString fSE; // Storage Element | |
72 | TString fMirrorSEs; // Mirror Storage Elements | |
73 | TString fCacheFolder; // local cache folder | |
74 | Bool_t fOperateDisconnected; // Operate disconnected flag | |
75 | Long64_t fCacheSize; // local cache size (in bytes) | |
76 | Long_t fCleanupInterval; // local cache cleanup interval | |
77 | ||
78 | ClassDef(AliCDBGrid, 0) // access class to a DataBase in an AliEn storage | |
9e1ceb13 | 79 | }; |
80 | ||
81 | ///////////////////////////////////////////////////////////////////// | |
82 | // // | |
83 | // class AliCDBGridFactory // | |
84 | // // | |
85 | ///////////////////////////////////////////////////////////////////// | |
86 | ||
87 | class AliCDBGridFactory: public AliCDBStorageFactory { | |
88 | ||
5078a13f | 89 | public: |
9e1ceb13 | 90 | |
5078a13f | 91 | virtual Bool_t Validate(const char* gridString); |
92 | virtual AliCDBParam* CreateParameter(const char* gridString); | |
93 | virtual ~AliCDBGridFactory(){} | |
9e1ceb13 | 94 | |
5078a13f | 95 | protected: |
96 | virtual AliCDBStorage* Create(const AliCDBParam* param); | |
9e1ceb13 | 97 | |
5078a13f | 98 | ClassDef(AliCDBGridFactory, 0); |
9e1ceb13 | 99 | }; |
100 | ||
101 | ///////////////////////////////////////////////////////////////////// | |
102 | // // | |
103 | // class AliCDBGridParam // | |
104 | // // | |
105 | ///////////////////////////////////////////////////////////////////// | |
106 | ||
107 | class AliCDBGridParam: public AliCDBParam { | |
5078a13f | 108 | |
109 | public: | |
110 | AliCDBGridParam(); | |
111 | AliCDBGridParam(const char* gridUrl, const char* user, | |
112 | const char* dbFolder, const char* se, | |
113 | const char* cacheFolder, Bool_t operateDisconnected, | |
114 | Long64_t cacheSize, Long_t cleanupInterval); | |
115 | ||
116 | virtual ~AliCDBGridParam(); | |
117 | ||
118 | const TString& GridUrl() const {return fGridUrl;} | |
119 | const TString& GetUser() const {return fUser;} | |
120 | const TString& GetDBFolder() const {return fDBFolder;} | |
121 | const TString& GetSE() const {return fSE;} | |
122 | const TString& GetCacheFolder() const {return fCacheFolder;} | |
123 | Bool_t GetOperateDisconnected() const {return fOperateDisconnected;} | |
124 | Long64_t GetCacheSize() const {return fCacheSize;} | |
125 | Long_t GetCleanupInterval() const {return fCleanupInterval;} | |
126 | ||
127 | virtual AliCDBParam* CloneParam() const; | |
128 | ||
129 | virtual ULong_t Hash() const; | |
130 | virtual Bool_t IsEqual(const TObject* obj) const; | |
131 | ||
132 | private: | |
133 | TString fGridUrl; // Grid url "Host:port" | |
134 | TString fUser; // User | |
135 | TString fDBFolder; // path of the DB folder | |
136 | TString fSE; // Storage Element | |
137 | TString fCacheFolder; // Cache folder | |
138 | Bool_t fOperateDisconnected; // Operate disconnected flag | |
139 | Long64_t fCacheSize; // local cache size (in bytes) | |
140 | Long_t fCleanupInterval; // local cache cleanup interval | |
141 | ||
142 | ClassDef(AliCDBGridParam, 0); | |
9e1ceb13 | 143 | }; |
144 | ||
145 | ||
146 | #endif |