Project
Loading...
Searching...
No Matches
CCDBFetcherHelper.h
Go to the documentation of this file.
1// Copyright 2019-2025 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11#ifndef O2_FRAMEWORK_CCDBFETCHERHELPER_H_
12#define O2_FRAMEWORK_CCDBFETCHERHELPER_H_
13
16#include "CCDB/CcdbApi.h"
17#include <unordered_map>
18#include <string>
19
20namespace o2::framework
21{
22
23struct DataTakingContext;
24
27 std::string etag;
28 size_t cacheValidUntil = 0;
29 size_t cachePopulatedAt = 0;
30 size_t cacheMiss = 0;
31 size_t cacheHit = 0;
32 size_t size = 0L;
33 size_t minSize = -1ULL;
34 size_t maxSize = 0;
37 };
38
39 struct RemapMatcher {
40 std::string path;
41 };
42
43 struct RemapTarget {
44 std::string url;
45 };
46
47 struct ParserResult {
48 std::unordered_map<std::string, std::string> remappings;
49 std::string error;
50 };
51
53 std::string key;
54 std::string value;
55 };
56
57 // A fetch operation.
58 struct FetchOp {
59 // Where to put the blob
61 // The url to fetch
62 std::string url = "";
63 // The timestamp to use
64 int64_t timestamp = 0;
65 // The run to use
66 int runNumber = 0;
67 // Wether or not the thing is run dependent
68 int runDependent = 0;
69 // Actual metadata
70 std::vector<MetadataEntry> metadata = {};
71 // Query rate
72 int queryRate = 0;
73 };
74
75 // Where the data has been fetched
76 struct Response {
77 // CacheId / Pointer to the actual data
79 // The size of the buffer
80 size_t size = 0;
81 // Where to actually
82 FetchOp* request = nullptr;
83 };
84
85 static ParserResult parseRemappings(char const*);
86
87 std::unordered_map<std::string, CCDBCacheInfo> mapURL2UUID;
88 std::unordered_map<std::string, DataAllocator::CacheId> mapURL2DPLCache;
89 std::string createdNotBefore = "0";
90 std::string createdNotAfter = "3385078236000";
91 std::unordered_map<std::string, o2::ccdb::CcdbApi> apis;
92 std::vector<OutputRoute> routes;
93 std::unordered_map<std::string, std::string> remappings;
94 uint32_t lastCheckedTFCounterOrbReset = 0; // last checkecked TFcounter for bulk check
97 int64_t timeToleranceMS = 5000;
98 int useTFSlice = 0; // if non-zero, use TFslice instead of TFcounter for the validity check. If > requested checking rate, add additional check on |lastTFchecked - TCcounter|<=useTFSlice
99
100 o2::ccdb::CcdbApi& getAPI(const std::string& path);
101 static void initialiseHelper(CCDBFetcherHelper& helper, ConfigParamRegistry const& options);
102 static auto populateCacheWith(std::shared_ptr<CCDBFetcherHelper> const& helper,
103 std::vector<FetchOp> const& ops,
104 TimingInfo& timingInfo,
106 DataAllocator& allocator) -> std::vector<Response>;
107};
108
109} // namespace o2::framework
110
111#endif // O2_FRAMEWORK_CCDBFETCHERHELPER_H_
GLsizeiptr size
Definition glcorearb.h:659
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::unordered_map< std::string, std::string > remappings
o2::ccdb::CcdbApi & getAPI(const std::string &path)
std::vector< OutputRoute > routes
std::unordered_map< std::string, std::string > remappings
static auto populateCacheWith(std::shared_ptr< CCDBFetcherHelper > const &helper, std::vector< FetchOp > const &ops, TimingInfo &timingInfo, DataTakingContext &dtc, DataAllocator &allocator) -> std::vector< Response >
std::unordered_map< std::string, DataAllocator::CacheId > mapURL2DPLCache
std::unordered_map< std::string, o2::ccdb::CcdbApi > apis
static void initialiseHelper(CCDBFetcherHelper &helper, ConfigParamRegistry const &options)
std::unordered_map< std::string, CCDBCacheInfo > mapURL2UUID
static ParserResult parseRemappings(char const *)