ATLAS Offline Software
CrestApiBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2019-2024 CERN for the benefit of the ATLAS collaboration
3  */
4 
14 #ifndef CRESTAPI_CRESAPIBASE_H
15 #define CRESTAPI_CRESAPIBASE_H
16 
17 #include <string>
18 #include <map>
19 #include <list>
20 #include <iosfwd>
21 #include <cstdint>
22 #include "nlohmann/json.hpp"
23 #include <curl/curl.h>
24 #include <iostream>
25 #include <CrestApi/CrestModel.h>
26 
27 #define DEFAULT_CREST_API_VERSION "/api-v5.0"
28 
29 namespace Crest
30 {
31 
32 class CrestApiBase {
33 
34 public:
35  virtual ~CrestApiBase() = default;
36  // GlobaTag methods
37 
66 
67 
74  virtual GlobalTagDto findGlobalTag(const std::string& name) = 0;
75 
84  virtual GlobalTagSetDto listGlobalTags(const std::string& name, int size, int page, const std::string& sort) = 0;
85 
91  virtual void removeGlobalTag(const std::string& name) = 0;
92 
93  // Tag methods
94 
123  virtual void createTag(TagDto& tag) = 0;
124 
131  virtual TagDto findTag(const std::string& name) = 0;
132 
142  virtual TagSetDto listTags(const std::string& name, int size, int page, const std::string& sort) = 0;
143 
149  virtual void removeTag(const std::string& name) = 0;
150 
157  virtual int getSize(const std::string& tagname) = 0;
158 
159  // Tag Meta Info methods
160 
193  virtual void createTagMeta(TagMetaDto& tag) = 0;
194 
199  virtual void updateTagMeta(TagMetaDto& tag) = 0;
200 
206  virtual TagMetaDto findTagMeta(const std::string& name) = 0;
207 
208 
209  // IOV methods
210 
223  virtual IovSetDto selectIovs(const std::string& name, uint64_t since, uint64_t until, long snapshot, int size, int page, const std::string& sort) = 0;
224 
235  virtual IovSetDto selectGroups(const std::string& name, long snapshot, int size, int page, const std::string& sort) = 0;
236 
237  // GlobalTagMap methods
238 
260  virtual void createGlobalTagMap(GlobalTagMapDto& globalTagMap) = 0;
261 
269  virtual GlobalTagMapSetDto findGlobalTagMap(const std::string& name, const std::string& xCrestMapMode) = 0;
270 
277  virtual void removeGlobalTagMap(const std::string& name, const std::string& record, const std::string& label, const std::string& tagname) = 0;
278 
279  // Payload methods
280 
305  virtual void storeData(const std::string& tag,
306  const StoreSetDto& storeSetJson,
307  const std::string& payloadFormat,
308  const std::string& objectType,
309  const std::string& compressionType,
310  const std::string& version,
311  uint64_t endTime) = 0;
312 
313 
314  // Payload retrieval methods
315 
322  virtual std::string getPayload(const std::string& hash) = 0;
323 
330  virtual PayloadDto getPayloadMeta(const std::string& hash) = 0;
331 
332 };
333 
334 } // namespace Crest
335 
336 #endif // CRESTAPI_CRESTCLIENT_H
Crest::CrestApiBase::listTags
virtual TagSetDto listTags(const std::string &name, int size, int page, const std::string &sort)=0
This method returns the tag list as TagSetDto.
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
CrestModel.h
Crest::CrestApiBase::~CrestApiBase
virtual ~CrestApiBase()=default
Crest::CrestApiBase::createTagMeta
virtual void createTagMeta(TagMetaDto &tag)=0
This method creates a tag meta info.
TagSetDto
Definition: CrestModel.h:126
Crest::CrestApiBase::removeGlobalTagMap
virtual void removeGlobalTagMap(const std::string &name, const std::string &record, const std::string &label, const std::string &tagname)=0
This method removes a global tag map.
GlobalTagSetDto
Definition: CrestModel.h:81
Crest
Definition: CrestApi.h:30
Crest::CrestApiBase::createTag
virtual void createTag(TagDto &tag)=0
This method creates a tag.
makeDTCalibBlob_pickPhase.globalTag
globalTag
Definition: makeDTCalibBlob_pickPhase.py:398
TagMetaDto
Definition: CrestModel.h:238
hotSpotInTAG.objectType
objectType
Definition: hotSpotInTAG.py:107
PayloadDto
Definition: CrestModel.h:345
dq_defect_copy_defect_database.since
def since
Definition: dq_defect_copy_defect_database.py:54
dq_defect_copy_defect_database.until
def until
Definition: dq_defect_copy_defect_database.py:55
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Crest::CrestApiBase::listGlobalTags
virtual GlobalTagSetDto listGlobalTags(const std::string &name, int size, int page, const std::string &sort)=0
This method finds the global tags.
Crest::CrestApiBase::findGlobalTag
virtual GlobalTagDto findGlobalTag(const std::string &name)=0
This method finds a global tag by name.
Crest::CrestApiBase::removeTag
virtual void removeTag(const std::string &name)=0
This method removes a tag.
GlobalTagDto
Definition: CrestModel.h:55
Crest::CrestApiBase::updateTagMeta
virtual void updateTagMeta(TagMetaDto &tag)=0
This method updates a tag meta info.
Crest::CrestApiBase::createGlobalTag
virtual void createGlobalTag(GlobalTagDto &globalTag)=0
This method creates a global tag.
TagDto
The TagDto class It contains all fields of the TagDto class from the CREST API.
Definition: CrestModel.h:98
Crest::CrestApiBase::findTag
virtual TagDto findTag(const std::string &name)=0
This method finds a tag by the name.
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
Crest::CrestApiBase
Definition: CrestApiBase.h:32
Crest::CrestApiBase::createGlobalTagMap
virtual void createGlobalTagMap(GlobalTagMapDto &globalTagMap)=0
This method creates a global tag map.
GlobalTagMapSetDto
Definition: CrestModel.h:160
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MyPlots.page
page
Definition: MyPlots.py:234
get_generator_info.version
version
Definition: get_generator_info.py:33
Crest::CrestApiBase::findTagMeta
virtual TagMetaDto findTagMeta(const std::string &name)=0
This method gets a tag meta info by the tag name.
Crest::CrestApiBase::selectGroups
virtual IovSetDto selectGroups(const std::string &name, long snapshot, int size, int page, const std::string &sort)=0
This method returns IOV groups for a given tagname.
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
IovSetDto
Definition: CrestModel.h:287
Crest::CrestApiBase::getPayloadMeta
virtual PayloadDto getPayloadMeta(const std::string &hash)=0
This method finds a payload meta info for the hash.
tagname
Definition: tagname.h:29
Crest::CrestApiBase::storeData
virtual void storeData(const std::string &tag, const StoreSetDto &storeSetJson, const std::string &payloadFormat, const std::string &objectType, const std::string &compressionType, const std::string &version, uint64_t endTime)=0
This method stores several payloads in batch mode.
Crest::CrestApiBase::getPayload
virtual std::string getPayload(const std::string &hash)=0
This method finds a payload resource associated to the hash.
Crest::CrestApiBase::getSize
virtual int getSize(const std::string &tagname)=0
This method gets the number of IOVs for the given tag.
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
StoreSetDto
Definition: CrestModel.h:331
Crest::CrestApiBase::findGlobalTagMap
virtual GlobalTagMapSetDto findGlobalTagMap(const std::string &name, const std::string &xCrestMapMode)=0
This method searches for tag mappings using the global tag name or tag name .
Crest::CrestApiBase::removeGlobalTag
virtual void removeGlobalTag(const std::string &name)=0
This method removes a global tag.
GlobalTagMapDto
Definition: CrestModel.h:139
lumiFormat.endTime
endTime
Definition: lumiFormat.py:100
Crest::CrestApiBase::selectIovs
virtual IovSetDto selectIovs(const std::string &name, uint64_t since, uint64_t until, long snapshot, int size, int page, const std::string &sort)=0
This method selects IOVs for a given tagname.