Implementing the exponential retry when putting an object in the OCDB. The function...
[u/mrichter/AliRoot.git] / STEER / CDB / AliCDBGrid.h
CommitLineData
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
18class AliCDBGrid: public AliCDBStorage {
19 friend class AliCDBGridFactory;
20
21public:
22
c3a7b59a 23 virtual Bool_t IsReadOnly() const {return kFALSE;}
24 virtual Bool_t HasSubVersion() const {return kFALSE;}
b05400be 25 virtual Bool_t Contains(const char* path) const;
c3a7b59a 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;
89004e35 29 virtual void SetRetry(Int_t nretry, Int_t totsec);
c3a7b59a 30
9e1ceb13 31protected:
32
33 virtual AliCDBEntry* GetEntry(const AliCDBId& queryId);
4667c116 34 virtual AliCDBId* GetEntryId(const AliCDBId& queryId);
9e1ceb13 35 virtual TList* GetEntries(const AliCDBId& queryId);
36 virtual Bool_t PutEntry(AliCDBEntry* entry);
b05400be 37 virtual TList* GetIdListFromFile(const char* fileName);
9e1ceb13 38
39private:
c75fabed 40
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);
9e1ceb13 44
45 virtual ~AliCDBGrid();
46
47 AliCDBGrid(const AliCDBGrid& db);
48 AliCDBGrid& operator = (const AliCDBGrid& db);
49
62032124 50 Bool_t FilenameToId(TString& filename, AliCDBId& id);
9e1ceb13 51
52 Bool_t PrepareId(AliCDBId& id);
6dc56e97 53 AliCDBId* GetId(const TObjArray& validFileIds, const AliCDBId& query);
8e245d15 54 AliCDBEntry* GetEntryFromFile(TString& filename, AliCDBId* dataId);
9e1ceb13 55
4667c116 56 // TODO use AliEnTag classes!
62032124 57 Bool_t AddTag(TString& foldername, const char* tagname);
c3a7b59a 58 Bool_t TagFileId(TString& filename, const AliCDBId* id);
59 Bool_t TagFileMetaData(TString& filename, const AliCDBMetaData* md);
4667c116 60 Bool_t TagShortLived(TString& filename, Bool_t value);
9e1ceb13 61
6dc56e97 62 void MakeQueryFilter(Int_t firstRun, Int_t lastRun, const AliCDBMetaData* md, TString& result) const;
62032124 63
64 virtual void QueryValidFiles();
9e1ceb13 65
c75fabed 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
9e1ceb13 74
4667c116 75ClassDef(AliCDBGrid, 0) // access class to a DataBase in an AliEn storage
9e1ceb13 76};
77
78/////////////////////////////////////////////////////////////////////
79// //
80// class AliCDBGridFactory //
81// //
82/////////////////////////////////////////////////////////////////////
83
84class AliCDBGridFactory: public AliCDBStorageFactory {
85
86public:
87
88 virtual Bool_t Validate(const char* gridString);
89 virtual AliCDBParam* CreateParameter(const char* gridString);
f430a9ce 90 virtual ~AliCDBGridFactory(){}
9e1ceb13 91
92protected:
93 virtual AliCDBStorage* Create(const AliCDBParam* param);
94
95 ClassDef(AliCDBGridFactory, 0);
96};
97
98/////////////////////////////////////////////////////////////////////
99// //
100// class AliCDBGridParam //
101// //
102/////////////////////////////////////////////////////////////////////
103
104class AliCDBGridParam: public AliCDBParam {
105
106public:
107 AliCDBGridParam();
62032124 108 AliCDBGridParam(const char* gridUrl, const char* user,
c75fabed 109 const char* dbFolder, const char* se,
110 const char* cacheFolder, Bool_t operateDisconnected,
111 Long64_t cacheSize, Long_t cleanupInterval);
9e1ceb13 112
113 virtual ~AliCDBGridParam();
114
c75fabed 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;}
9e1ceb13 123
124 virtual AliCDBParam* CloneParam() const;
125
126 virtual ULong_t Hash() const;
127 virtual Bool_t IsEqual(const TObject* obj) const;
128
129private:
c75fabed 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
9e1ceb13 138
139 ClassDef(AliCDBGridParam, 0);
140};
141
142
143#endif