forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStorage.h
More file actions
176 lines (115 loc) · 5.18 KB
/
Copy pathStorage.h
File metadata and controls
176 lines (115 loc) · 5.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef ALICEO2_CDB_STORAGE_H_
#define ALICEO2_CDB_STORAGE_H_
// interface to specific storage classes //
// ( GridStorage, LocalStorage, FileStorage) //
#include <TList.h> // for TList
#include <TObjArray.h> // for TObjArray
#include "CCDB/IdPath.h" // for IdPath
#include "Rtypes.h" // for Int_t, Bool_t, Short_t, Storage::Class, etc
#include "TObject.h" // for TObject
#include "TString.h" // for TString
class TFile;
namespace o2
{
namespace ccdb
{
class Condition;
class ConditionId;
class ConditionMetaData;
class IdRunRange;
class IdPath;
class Param;
class Storage : public TObject
{
public:
Storage();
void setUri(const TString& uri)
{
mURI = uri;
}
const TString& getUri() const
{
return mURI;
}
const TString& getStorageType() const
{
return mType;
}
const TString& getBaseFolder() const
{
return mBaseFolder;
}
void readSelectionFromFile(const char* fileName);
void addSelection(const ConditionId& selection);
void addSelection(const IdPath& path, const IdRunRange& runRange, Int_t version, Int_t subVersion = -1);
void addSelection(const IdPath& path, Int_t firstRun, Int_t lastRun, Int_t version, Int_t subVersion = -1);
void removeSelection(const ConditionId& selection);
void removeSelection(const IdPath& path, const IdRunRange& runRange);
void removeSelection(const IdPath& path, Int_t firstRun = -1, Int_t lastRun = -1);
void removeSelection(int position);
void removeAllSelections();
void printSelectionList();
Condition* getObject(const ConditionId& query);
Condition* getObject(const IdPath& path, Int_t runNumber, Int_t version = -1, Int_t subVersion = -1);
Condition* getObject(const IdPath& path, const IdRunRange& runRange, Int_t version = -1, Int_t subVersion = -1);
TList* getAllObjects(const ConditionId& query);
TList* getAllObjects(const IdPath& path, Int_t runNumber, Int_t version = -1, Int_t subVersion = -1);
TList* getAllObjects(const IdPath& path, const IdRunRange& runRange, Int_t version = -1, Int_t subVersion = -1);
ConditionId* getId(const ConditionId& query);
ConditionId* getId(const IdPath& path, Int_t runNumber, Int_t version = -1, Int_t subVersion = -1);
ConditionId* getId(const IdPath& path, const IdRunRange& runRange, Int_t version = -1, Int_t subVersion = -1);
Bool_t putObject(TObject* object, ConditionId& id, ConditionMetaData* metaData, const char* mirrors = "");
Bool_t putObject(Condition* entry, const char* mirrors = "");
virtual void setMirrorSEs(const char* mirrors);
virtual const char* getMirrorSEs() const;
virtual Bool_t isReadOnly() const = 0;
virtual Bool_t hasSubVersion() const = 0;
virtual Bool_t hasConditionType(const char* path) const = 0;
virtual Bool_t idToFilename(const ConditionId& id, TString& filename) const = 0;
void
queryStorages(Int_t run, const char* pathFilter = "*", Int_t version = -1, ConditionMetaData* mdFilter = nullptr);
void printrQueryStorages();
TObjArray* getQueryStoragesList()
{
return &mValidFileIds;
}
virtual void setRetry(Int_t nretry, Int_t initsec) = 0;
protected:
~Storage() override;
void getSelection(/*const*/ ConditionId* id);
virtual Condition* getCondition(const ConditionId& query) = 0;
virtual ConditionId* getConditionId(const ConditionId& query) = 0;
virtual TList* getAllEntries(const ConditionId& query) = 0;
virtual Bool_t putCondition(Condition* entry, const char* mirrors = "") = 0;
virtual TList* getIdListFromFile(const char* fileName) = 0;
virtual void queryValidFiles() = 0;
void loadTreeFromFile(Condition* entry) const;
// void setTreeToFile( Condition* entry, TFile* file) const;
TObjArray mValidFileIds; // list of ConditionId's of the files valid for a given run (cached as mRun)
Int_t mRun; // run number, used to manage list of valid files
IdPath mPathFilter; // path filter, used to manage list of valid files
Int_t mVersion; // version, used to manage list of valid files
ConditionMetaData* mConditionMetaDataFilter; // metadata, used to manage list of valid files
TList mSelections; // list of selection criteria
TString mURI; // storage URI;
TString mType; //! LocalStorage, GridStorage: base folder name - Dump: file name
TString mBaseFolder; //! LocalStorage, GridStorage: base folder name - Dump: file name
Short_t mNretry; // Number of retries in opening the file
Short_t mInitRetrySeconds; // Seconds for first retry
private:
Storage(const Storage& source);
Storage& operator=(const Storage& source);
ClassDefOverride(Storage, 0)
};
}
}
#endif