Skip to content

Commit d944a8f

Browse files
njacazioshahor02
authored andcommitted
Rename UpperValidity -> CreatedNotAfter
1 parent e9003be commit d944a8f

4 files changed

Lines changed: 20 additions & 20 deletions

File tree

CCDB/include/CCDB/BasicCCDBManager.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ class BasicCCDBManager
9393
}
9494

9595
/// set the object upper validity limit
96-
void setUpperValidity(long v) { mUpperValidity = v; }
96+
void setCreatedNotAfter(long v) { mCreatedNotAfter = v; }
9797

9898
/// get the object upper validity limit
99-
long getUpperValidity() const { return mUpperValidity; }
99+
long getCreatedNotAfter() const { return mCreatedNotAfter; }
100100

101101
/// reset the object upper validity limit
102-
void resetUpperValidity() { mUpperValidity = 0; }
102+
void resetCreatedNotAfter() { mCreatedNotAfter = 0; }
103103

104104
private:
105105
BasicCCDBManager(std::string const& path) : mCCDBAccessor{}
@@ -115,7 +115,7 @@ class BasicCCDBManager
115115
long mTimestamp{o2::ccdb::getCurrentTimestamp()}; // timestamp to be used for query (by default "now")
116116
bool mCanDefault = false; // whether default is ok --> useful for testing purposes done standalone/isolation
117117
bool mCachingEnabled = true; // whether caching is enabled
118-
long mUpperValidity = 0; // upper limit for object validity timestamp (TimeMachine mode)
118+
long mCreatedNotAfter = 0; // upper limit for object validity timestamp (TimeMachine mode)
119119
};
120120

121121
template <typename T>
@@ -125,7 +125,7 @@ T* BasicCCDBManager::getForTimeStamp(std::string const& path, long timestamp)
125125
return mCCDBAccessor.retrieveFromTFileAny<T>(path, mMetaData, timestamp);
126126
}
127127
auto& cached = mCache[path];
128-
T* ptr = mCCDBAccessor.retrieveFromTFileAny<T>(path, mMetaData, timestamp, &mHeaders, cached.uuid, mUpperValidity ? std::to_string(mUpperValidity) : "");
128+
T* ptr = mCCDBAccessor.retrieveFromTFileAny<T>(path, mMetaData, timestamp, &mHeaders, cached.uuid, mCreatedNotAfter ? std::to_string(mCreatedNotAfter) : "");
129129
if (ptr) { // new object was shipped, old one (if any) is not valid anymore
130130
cached.objPtr.reset(ptr);
131131
cached.uuid = mHeaders["ETag"];

CCDB/include/CCDB/CcdbApi.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ class CcdbApi //: public DatabaseInterface
149149
* @param timestamp Timestamp of the object to retrieve. If omitted, current timestamp is used.
150150
* @param headers Map to be populated with the headers we received, if it is not null.
151151
* @param optional etag from previous call
152-
* @param optional upperValidity time limit for the object validity (TimeMachine mode)
152+
* @param optional createdNotAfter time limit for the object validity (TimeMachine mode)
153153
* @return the object, or nullptr if none were found.
154154
* @deprecated in favour of retrieveFromTFileAny as it is not limited to TObjects.
155155
*/
156156
TObject* retrieveFromTFile(std::string const& path, std::map<std::string, std::string> const& metadata,
157157
long timestamp = -1, std::map<std::string, std::string>* headers = nullptr, std::string const& etag = "",
158-
const std::string& upperValidity = "") const;
158+
const std::string& createdNotAfter = "") const;
159159

160160
/**
161161
* Retrieve object at the given path for the given timestamp.
@@ -165,13 +165,13 @@ class CcdbApi //: public DatabaseInterface
165165
* @param timestamp Timestamp of the object to retrieve. If omitted, current timestamp is used.
166166
* @param headers Map to be populated with the headers we received, if it is not null.
167167
* @param optional etag from previous call
168-
* @param optional upperValidity time limit for the object validity (TimeMachine mode)
168+
* @param optional createdNotAfter time limit for the object validity (TimeMachine mode)
169169
* @return the object, or nullptr if none were found or type does not match serialized type.
170170
*/
171171
template <typename T>
172172
T* retrieveFromTFileAny(std::string const& path, std::map<std::string, std::string> const& metadata,
173173
long timestamp = -1, std::map<std::string, std::string>* headers = nullptr, std::string const& etag = "",
174-
const std::string& upperValidity = "") const;
174+
const std::string& createdNotAfter = "") const;
175175

176176
/**
177177
* Delete all versions of the object at this path.
@@ -365,7 +365,7 @@ class CcdbApi //: public DatabaseInterface
365365
*/
366366
void* retrieveFromTFile(std::type_info const&, std::string const& path, std::map<std::string, std::string> const& metadata,
367367
long timestamp = -1, std::map<std::string, std::string>* headers = nullptr, std::string const& etag = "",
368-
const std::string& upperValidity = "") const;
368+
const std::string& createdNotAfter = "") const;
369369

370370
/**
371371
* A helper function to extract object from a local ROOT file
@@ -391,9 +391,9 @@ class CcdbApi //: public DatabaseInterface
391391
template <typename T>
392392
T* CcdbApi::retrieveFromTFileAny(std::string const& path, std::map<std::string, std::string> const& metadata,
393393
long timestamp, std::map<std::string, std::string>* headers, std::string const& etag,
394-
const std::string& upperValidity) const
394+
const std::string& createdNotAfter) const
395395
{
396-
return static_cast<T*>(retrieveFromTFile(typeid(T), path, metadata, timestamp, headers, etag, upperValidity));
396+
return static_cast<T*>(retrieveFromTFile(typeid(T), path, metadata, timestamp, headers, etag, createdNotAfter));
397397
}
398398

399399
} // namespace ccdb

CCDB/src/CcdbApi.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ size_t header_map_callback(char* buffer, size_t size, size_t nitems, void* userd
407407

408408
TObject* CcdbApi::retrieveFromTFile(std::string const& path, std::map<std::string, std::string> const& metadata,
409409
long timestamp, std::map<std::string, std::string>* headers, std::string const& etag,
410-
const std::string& upperValidity) const
410+
const std::string& createdNotAfter) const
411411
{
412412
// Note : based on https://curl.haxx.se/libcurl/c/getinmemory.html
413413
// Thus it does not comply to our coding guidelines as it is a copy paste.
@@ -447,8 +447,8 @@ TObject* CcdbApi::retrieveFromTFile(std::string const& path, std::map<std::strin
447447
list = curl_slist_append(list, ("If-None-Match: " + etag).c_str());
448448
}
449449

450-
if (!upperValidity.empty()) {
451-
list = curl_slist_append(list, ("If-Not-After: " + upperValidity).c_str());
450+
if (!createdNotAfter.empty()) {
451+
list = curl_slist_append(list, ("If-Not-After: " + createdNotAfter).c_str());
452452
}
453453

454454
// setup curl for headers handling
@@ -642,7 +642,7 @@ void* CcdbApi::extractFromLocalFile(std::string const& filename, TClass const* t
642642
void* CcdbApi::retrieveFromTFile(std::type_info const& tinfo, std::string const& path,
643643
std::map<std::string, std::string> const& metadata, long timestamp,
644644
std::map<std::string, std::string>* headers, std::string const& etag,
645-
const std::string& upperValidity) const
645+
const std::string& createdNotAfter) const
646646
{
647647
// We need the TClass for this type; will verify if dictionary exists
648648
auto tcl = TClass::GetClass(tinfo);
@@ -691,8 +691,8 @@ void* CcdbApi::retrieveFromTFile(std::type_info const& tinfo, std::string const&
691691
list = curl_slist_append(list, ("If-None-Match: " + etag).c_str());
692692
}
693693

694-
if (!upperValidity.empty()) {
695-
list = curl_slist_append(list, ("If-Not-After: " + upperValidity).c_str());
694+
if (!createdNotAfter.empty()) {
695+
list = curl_slist_append(list, ("If-Not-After: " + createdNotAfter).c_str());
696696
}
697697

698698
// setup curl for headers handling

CCDB/test/testBasicCCDBManager.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ BOOST_AUTO_TEST_CASE(TestBasicCCDBManager)
100100
BOOST_CHECK(objB && (*objB) == ccdbObjO); // make sure correct object is loaded
101101

102102
// get object in TimeMachine mode in the past
103-
cdb.setUpperValidity(1); // set upper object validity
103+
cdb.setCreatedNotAfter(1); // set upper object validity
104104
objA = cdb.get<std::string>(pathA); // should not be loaded
105105
BOOST_CHECK(!objA); // make sure correct object is not loaded
106-
cdb.resetUpperValidity(); // resetting upper validity limit
106+
cdb.resetCreatedNotAfter(); // resetting upper validity limit
107107

108108
// disable cache at all (will also clean it)
109109
cdb.setCachingEnabled(false);

0 commit comments

Comments
 (0)