Skip to content

Commit 5ca1a7f

Browse files
njacazioshahor02
authored andcommitted
Remove AnalysisCCDBManager and move features to BasicCCDBManager
1 parent 79ee26e commit 5ca1a7f

4 files changed

Lines changed: 12 additions & 91 deletions

File tree

CCDB/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
o2_add_library(CCDB
1212
SOURCES src/CcdbApi.cxx
1313
src/BasicCCDBManager.cxx
14-
src/AnalysisCCDBManager.cxx
1514
src/CCDBTimeStampUtils.cxx
1615
src/IdPath.cxx src/CCDBQuery.cxx
1716
PUBLIC_LINK_LIBRARIES CURL::libcurl
@@ -28,7 +27,6 @@ o2_target_root_dictionary(CCDB
2827
include/CCDB/TObjectWrapper.h
2928
include/CCDB/IdPath.h
3029
include/CCDB/BasicCCDBManager.h
31-
include/CCDB/AnalysisCCDBManager.h
3230
include/CCDB/CCDBTimeStampUtils.h
3331
include/CCDB/CCDBQuery.h)
3432

CCDB/include/CCDB/AnalysisCCDBManager.h

Lines changed: 0 additions & 66 deletions
This file was deleted.

CCDB/include/CCDB/BasicCCDBManager.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class BasicCCDBManager
3333
struct CachedObject {
3434
std::shared_ptr<void> objPtr;
3535
std::string uuid;
36+
long startvalidity = 0;
37+
long endvalidity = 0;
38+
bool isValid(long ts) { return ts < endvalidity && ts > startvalidity; }
3639
};
3740

3841
public:
@@ -92,6 +95,12 @@ class BasicCCDBManager
9295
}
9396
}
9497

98+
/// check if checks of object validity before CCDB query is enabled
99+
bool isValidityCheckingEnabled() const { return mCheckObjValidityEnabled; }
100+
101+
/// set the flag to check object validity before CCDB query
102+
void setValidityCheckingEnabled(bool v = true) { mCheckObjValidityEnabled = v; }
103+
95104
/// set the object upper validity limit
96105
void setCreatedNotAfter(long v) { mCreatedNotAfter = v; }
97106

@@ -124,6 +133,7 @@ class BasicCCDBManager
124133
long mTimestamp{o2::ccdb::getCurrentTimestamp()}; // timestamp to be used for query (by default "now")
125134
bool mCanDefault = false; // whether default is ok --> useful for testing purposes done standalone/isolation
126135
bool mCachingEnabled = true; // whether caching is enabled
136+
bool mCheckObjValidityEnabled = false; // wether the validity of cached object is checked before proceeding to a CCDB API query
127137
long mCreatedNotAfter = 0; // upper limit for object creation timestamp (TimeMachine mode) - If-Not-After HTTP header
128138
long mCreatedNotBefore = 0; // lower limit for object creation timestamp (TimeMachine mode) - If-Not-Before HTTP header
129139
};
@@ -143,6 +153,8 @@ T* BasicCCDBManager::getForTimeStamp(std::string const& path, long timestamp)
143153
if (ptr) { // new object was shipped, old one (if any) is not valid anymore
144154
cached.objPtr.reset(ptr);
145155
cached.uuid = mHeaders["ETag"];
156+
cached.startvalidity = std::stol(mMetaData["Valid-From"]);
157+
cached.endvalidity = std::stol(mMetaData["Valid-Until"]);
146158
} else if (mHeaders.count("Error")) { // in case of errors the pointer is 0 and headers["Error"] should be set
147159
clearCache(path); // in case of any error clear cache for this object
148160
} else { // the old object is valid

CCDB/src/AnalysisCCDBManager.cxx

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)