@@ -46,20 +46,17 @@ class CCDBManagerInstance
4646 std::string uuid;
4747 long startvalidity = 0 ;
4848 long endvalidity = -1 ;
49- bool isBlob = false ; // is this raw blob or parsed object?
5049 bool isValid (long ts) { return ts < endvalidity && ts > startvalidity; }
5150 void clear ()
5251 {
5352 objPtr.reset ();
5453 uuid = " " ;
5554 startvalidity = 0 ;
5655 endvalidity = -1 ;
57- isBlob = false ;
5856 }
5957 };
6058
6159 public:
62- using BLOB = std::vector<char >;
6360 using MD = std::map<std::string, std::string>;
6461
6562 CCDBManagerInstance (std::string const & path) : mCCDBAccessor {}
@@ -103,11 +100,6 @@ class CCDBManagerInstance
103100 return getForTimeStamp<T>(path, mTimestamp );
104101 }
105102
106- // / aliases for BLOB retrieval
107- BLOB * getBlobForTimeStamp (std::string const & path, long timestamp) { return getForTimeStamp<BLOB >(path, timestamp); }
108- BLOB * getSpecificBlob (std::string const & path, long timestamp = -1 , MD metaData = MD ()) { return getSpecific<BLOB >(path, timestamp, metaData); }
109- BLOB * getBlob (std::string const & path) { return get<BLOB >(path); }
110-
111103 bool isHostReachable () const { return mCCDBAccessor .isHostReachable (); }
112104
113105 // / clear all entries in the cache
@@ -164,10 +156,6 @@ class CCDBManagerInstance
164156 private:
165157 // method to print (fatal) error
166158 void reportFatal (std::string_view s);
167- BLOB * createBlob (std::string const & path,
168- MD const & metadata, long timestamp,
169- MD * headers, std::string const & etag,
170- const std::string& createdNotAfter, const std::string& createdNotBefore);
171159 // we access the CCDB via the CURL based C++ API
172160 o2::ccdb::CcdbApi mCCDBAccessor ;
173161 std::unordered_map<std::string, CachedObject> mCache ; // ! map for {path, CachedObject} associations
@@ -189,53 +177,27 @@ T* CCDBManagerInstance::getForTimeStamp(std::string const& path, long timestamp)
189177{
190178 T* ptr = nullptr ;
191179 if (!isCachingEnabled ()) {
192- if constexpr (std::is_same<T, BLOB >::value) {
193- ptr = createBlob (path, mMetaData , timestamp, nullptr , " " ,
194- mCreatedNotAfter ? std::to_string (mCreatedNotAfter ) : " " ,
195- mCreatedNotBefore ? std::to_string (mCreatedNotBefore ) : " " );
196- } else {
197- ptr = mCCDBAccessor .retrieveFromTFileAny <T>(path, mMetaData , timestamp, nullptr , " " ,
198- mCreatedNotAfter ? std::to_string (mCreatedNotAfter ) : " " ,
199- mCreatedNotBefore ? std::to_string (mCreatedNotBefore ) : " " );
200- }
180+ ptr = mCCDBAccessor .retrieveFromTFileAny <T>(path, mMetaData , timestamp, nullptr , " " ,
181+ mCreatedNotAfter ? std::to_string (mCreatedNotAfter ) : " " ,
182+ mCreatedNotBefore ? std::to_string (mCreatedNotBefore ) : " " );
201183 if (!ptr && mFatalWhenNull ) {
202184 reportFatal (std::string (" Got nullptr from CCDB for path " ) + path + std::string (" and timestamp " ) + std::to_string (timestamp));
203185 }
204186 return ptr;
205187 }
206188 auto & cached = mCache [path];
207- if constexpr (std::is_same<T, BLOB >::value) { // check if cached object type is consistent with requested one
208- if (!cached.isBlob ) {
209- cached.clear ();
210- }
211- } else {
212- if (cached.isBlob ) {
213- cached.clear ();
214- }
215- }
216189 if (mCheckObjValidityEnabled && cached.isValid (timestamp)) {
217190 return reinterpret_cast <T*>(cached.noCleanupPtr ? cached.noCleanupPtr : cached.objPtr .get ());
218191 }
219- if constexpr (std::is_same<T, BLOB >::value) {
220- ptr = createBlob (path, mMetaData , timestamp, &mHeaders , cached.uuid ,
221- mCreatedNotAfter ? std::to_string (mCreatedNotAfter ) : " " ,
222- mCreatedNotBefore ? std::to_string (mCreatedNotBefore ) : " " );
223- } else {
224- ptr = mCCDBAccessor .retrieveFromTFileAny <T>(path, mMetaData , timestamp, &mHeaders , cached.uuid ,
225- mCreatedNotAfter ? std::to_string (mCreatedNotAfter ) : " " ,
226- mCreatedNotBefore ? std::to_string (mCreatedNotBefore ) : " " );
227- }
192+ ptr = mCCDBAccessor .retrieveFromTFileAny <T>(path, mMetaData , timestamp, &mHeaders , cached.uuid ,
193+ mCreatedNotAfter ? std::to_string (mCreatedNotAfter ) : " " ,
194+ mCreatedNotBefore ? std::to_string (mCreatedNotBefore ) : " " );
228195 if (ptr) { // new object was shipped, old one (if any) is not valid anymore
229196 if constexpr (std::is_same<TGeoManager, T>::value) { // some special objects cannot be cached to shared_ptr since root may delete their raw global pointer
230197 cached.noCleanupPtr = ptr;
231198 } else {
232199 cached.objPtr .reset (ptr);
233200 }
234- if constexpr (std::is_same<T, BLOB >::value) {
235- cached.isBlob = true ;
236- } else {
237- cached.isBlob = false ;
238- }
239201 cached.uuid = mHeaders [" ETag" ];
240202 cached.startvalidity = std::stol (mHeaders [" Valid-From" ]);
241203 cached.endvalidity = std::stol (mHeaders [" Valid-Until" ]);
0 commit comments