1- // Copyright 2019-2020 CERN and copyright holders of ALICE O2.
1+ // Copyright 2019-2025 CERN and copyright holders of ALICE O2.
22// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
33// All rights not expressly granted are reserved.
44//
1010// or submit itself to any jurisdiction.
1111
1212#include " CCDBHelpers.h"
13+ #include " CCDBFetcherHelper.h"
1314#include " Framework/DeviceSpec.h"
1415#include " Framework/Logger.h"
1516#include " Framework/TimingInfo.h"
@@ -28,56 +29,6 @@ O2_DECLARE_DYNAMIC_LOG(ccdb);
2829namespace o2 ::framework
2930{
3031
31- struct CCDBFetcherHelper {
32- struct CCDBCacheInfo {
33- std::string etag;
34- size_t cacheValidUntil = 0 ;
35- size_t cachePopulatedAt = 0 ;
36- size_t cacheMiss = 0 ;
37- size_t cacheHit = 0 ;
38- size_t minSize = -1ULL ;
39- size_t maxSize = 0 ;
40- int lastCheckedTF = 0 ;
41- };
42-
43- struct RemapMatcher {
44- std::string path;
45- };
46-
47- struct RemapTarget {
48- std::string url;
49- };
50-
51- std::unordered_map<std::string, CCDBCacheInfo> mapURL2UUID;
52- std::unordered_map<std::string, DataAllocator::CacheId> mapURL2DPLCache;
53- std::string createdNotBefore = " 0" ;
54- std::string createdNotAfter = " 3385078236000" ;
55- std::unordered_map<std::string, o2::ccdb::CcdbApi> apis;
56- std::vector<OutputRoute> routes;
57- std::unordered_map<std::string, std::string> remappings;
58- uint32_t lastCheckedTFCounterOrbReset = 0 ; // last checkecked TFcounter for bulk check
59- int queryPeriodGlo = 1 ;
60- int queryPeriodFactor = 1 ;
61- int64_t timeToleranceMS = 5000 ;
62-
63- o2::ccdb::CcdbApi& getAPI (const std::string& path)
64- {
65- // find the first = sign in the string. If present drop everything after it
66- // and between it and the previous /.
67- auto pos = path.find (' =' );
68- if (pos == std::string::npos) {
69- auto entry = remappings.find (path);
70- return apis[entry == remappings.end () ? " " : entry->second ];
71- }
72- auto pos2 = path.rfind (' /' , pos);
73- if (pos2 == std::string::npos || pos2 == pos - 1 || pos2 == 0 ) {
74- throw runtime_error_f (" Malformed path %s" , path.c_str ());
75- }
76- auto entry = remappings.find (path.substr (0 , pos2));
77- return apis[entry == remappings.end () ? " " : entry->second ];
78- }
79- };
80-
8132bool isPrefix (std::string_view prefix, std::string_view full)
8233{
8334 return prefix == full.substr (0 , prefix.size ());
0 commit comments