]>
Commit | Line | Data |
---|---|---|
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 // | |
10 | // access class to a DataBase in an AliEn storage // | |
11 | // // | |
12 | ///////////////////////////////////////////////////////////////////// | |
13 | ||
14 | #include "AliCDBStorage.h" | |
15 | #include "AliCDBManager.h" | |
16 | #include "AliCDBMetaData.h" | |
17 | ||
18 | class AliCDBGrid: public AliCDBStorage { | |
19 | friend class AliCDBGridFactory; | |
20 | ||
21 | public: | |
22 | ||
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 | ||
30 | protected: | |
31 | ||
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); | |
37 | ||
38 | private: | |
39 | ||
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); | |
43 | ||
44 | virtual ~AliCDBGrid(); | |
45 | ||
46 | AliCDBGrid(const AliCDBGrid& db); | |
47 | AliCDBGrid& operator = (const AliCDBGrid& db); | |
48 | ||
49 | Bool_t FilenameToId(TString& filename, AliCDBId& id); | |
50 | ||
51 | Bool_t PrepareId(AliCDBId& id); | |
52 | AliCDBId* GetId(const TObjArray& validFileIds, const AliCDBId& query); | |
53 | AliCDBEntry* GetEntryFromFile(TString& filename, AliCDBId* dataId); | |
54 | ||
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); | |
60 | ||
61 | void MakeQueryFilter(Int_t firstRun, Int_t lastRun, const AliCDBMetaData* md, TString& result) const; | |
62 | ||
63 | virtual void QueryValidFiles(); | |
64 | ||
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 | |
73 | ||
74 | ClassDef(AliCDBGrid, 0) // access class to a DataBase in an AliEn storage | |
75 | }; | |
76 | ||
77 | ///////////////////////////////////////////////////////////////////// | |
78 | // // | |
79 | // class AliCDBGridFactory // | |
80 | // // | |
81 | ///////////////////////////////////////////////////////////////////// | |
82 | ||
83 | class AliCDBGridFactory: public AliCDBStorageFactory { | |
84 | ||
85 | public: | |
86 | ||
87 | virtual Bool_t Validate(const char* gridString); | |
88 | virtual AliCDBParam* CreateParameter(const char* gridString); | |
89 | virtual ~AliCDBGridFactory(){} | |
90 | ||
91 | protected: | |
92 | virtual AliCDBStorage* Create(const AliCDBParam* param); | |
93 | ||
94 | ClassDef(AliCDBGridFactory, 0); | |
95 | }; | |
96 | ||
97 | ///////////////////////////////////////////////////////////////////// | |
98 | // // | |
99 | // class AliCDBGridParam // | |
100 | // // | |
101 | ///////////////////////////////////////////////////////////////////// | |
102 | ||
103 | class AliCDBGridParam: public AliCDBParam { | |
104 | ||
105 | public: | |
106 | AliCDBGridParam(); | |
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); | |
111 | ||
112 | virtual ~AliCDBGridParam(); | |
113 | ||
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;} | |
122 | ||
123 | virtual AliCDBParam* CloneParam() const; | |
124 | ||
125 | virtual ULong_t Hash() const; | |
126 | virtual Bool_t IsEqual(const TObject* obj) const; | |
127 | ||
128 | private: | |
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 | |
137 | ||
138 | ClassDef(AliCDBGridParam, 0); | |
139 | }; | |
140 | ||
141 | ||
142 | #endif |