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;
36 };
37
38 struct RemapMatcher {
39 std::string path;
40 };
41
42 struct RemapTarget {
43 std::string url;
44 };
45
46 struct ParserResult {
47 std::unordered_map<std::string, std::string> remappings;
48 std::string error;
49 };
50
52 std::string key;
53 std::string value;
54 };
55
56 // A fetch operation.
57 struct FetchOp {
58 // Where to put the blob
60 // The url to fetch
61 std::string url = "";
62 // The timestamp to use
63 int64_t timestamp = 0;
64 // The run to use
65 int runNumber = 0;
66 // Wether or not the thing is run dependent
67 int runDependent = 0;
68 // Actual metadata
69 std::vector<MetadataEntry> metadata = {};
70 // Query rate
71 int queryRate = 0;
72 };
73
74 // Where the data has been fetched
75 struct Response {
76 // CacheId / Pointer to the actual data
78 // The size of the buffer
79 size_t size = 0;
80 // Where to actually
81 FetchOp* request = nullptr;
82 };
83
84 static ParserResult parseRemappings(char const*);
85
86 std::unordered_map<std::string, CCDBCacheInfo> mapURL2UUID;
87 std::unordered_map<std::string, DataAllocator::CacheId> mapURL2DPLCache;
88 std::string createdNotBefore = "0";
89 std::string createdNotAfter = "3385078236000";
90 std::unordered_map<std::string, o2::ccdb::CcdbApi> apis;
91 std::vector<OutputRoute> routes;
92 std::unordered_map<std::string, std::string> remappings;
93 uint32_t lastCheckedTFCounterOrbReset = 0; // last checkecked TFcounter for bulk check
96 int64_t timeToleranceMS = 5000;
97
98 o2::ccdb::CcdbApi& getAPI(const std::string& path);
99 static void initialiseHelper(CCDBFetcherHelper& helper, ConfigParamRegistry const& options);
100 static auto populateCacheWith(std::shared_ptr<CCDBFetcherHelper> const& helper,
101 std::vector<FetchOp> const& ops,
102 TimingInfo& timingInfo,
104 DataAllocator& allocator) -> std::vector<Response>;
105};
106
107} // namespace o2::framework
108
109#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 *)