ATLAS Offline Software
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Crest::CrestClient Class Reference

#include <CrestApi.h>

Inheritance diagram for Crest::CrestClient:
Collaboration diagram for Crest::CrestClient:

Public Member Functions

 CrestClient (const std::string &host, const std::string &port, bool checkVersion=false)
 CrestClient constructor. More...
 
 CrestClient (std::string_view url, bool checkVersion=false)
 CrestClient constructor. More...
 
 ~CrestClient ()
 CrestClient destructor. More...
 
void checkCrestVersion ()
 This method is a CREST version test. More...
 
void createGlobalTag (GlobalTagDto &globalTag) override
 This method creates a global tag on CREST server. More...
 
GlobalTagDto findGlobalTag (const std::string &name) override
 This method finds a global tag by name on the CREST server. More...
 
GlobalTagSetDto listGlobalTags (const std::string &name, int size, int page, const std::string &sort) override
 This method finds the global tags on the CREST server. More...
 
void removeGlobalTag (const std::string &name) override
 This method removes a global tag on the CREST server. More...
 
void createTag (TagDto &tag) override
 This method creates a tag on the CREST server. More...
 
TagDto findTag (const std::string &name) override
 This method finds a tag by the name on the CREST server. More...
 
TagSetDto listTags (const std::string &name, int size, int page, const std::string &sort) override
 This method returns the tag list as TagSetDto from the CREST server. More...
 
void removeTag (const std::string &name) override
 This method removes a tag from the CREST server. More...
 
int getSize (const std::string &tagname) override
 This method gets the number of IOVs for the given tag. More...
 
void createTagMeta (TagMetaDto &tag) override
 This method creates a tag meta info on the CREST server. More...
 
void updateTagMeta (TagMetaDto &tag) override
 This method updates a tag meta info on the CREST server. More...
 
TagMetaDto findTagMeta (const std::string &name) override
 This method reads a tag meta info by the tag name from the CREST server. More...
 
void createGlobalTagMap (GlobalTagMapDto &globalTagMap) override
 This method creates a global tag map on the CREST server. More...
 
GlobalTagMapSetDto findGlobalTagMap (const std::string &name, const std::string &xCrestMapMode) override
 This method searches for tag mappings using the global tag name or tag name on the CREST server. More...
 
void removeGlobalTagMap (const std::string &name, const std::string &record, const std::string &label, const std::string &tagname) override
 This method removes a global tag map on the CREST server. More...
 
IovSetDto selectIovs (const std::string &name, uint64_t since, uint64_t until, long snapshot, int size, int page, const std::string &sort) override
 This method selects IOVs for a given tagname on the CREST server. More...
 
IovSetDto selectGroups (const std::string &name, long snapshot, int size, int page, const std::string &sort) override
 This method returns IOV groups for a given tagname on CREST server. More...
 
void storeData (const std::string &tag, const StoreSetDto &storeSetJson, const std::string &payloadFormat="JSON", const std::string &objectType="none", const std::string &compressionType="none", const std::string &version="1.0", uint64_t endTime=-1) override
 This method stores several payloads in batch mode on the CREST server. More...
 
std::string getPayload (const std::string &hash) override
 This method finds a payload resource associated to the hash on the CREST server. More...
 
PayloadDto getPayloadMeta (const std::string &hash) override
 This method finds a payload meta info for the hash on the CREST server. More...
 

Static Public Attributes

static const bool s_CREST_CLIENT_CHECK = false
 

Protected Member Functions

std::string getHash (std::string_view str)
 This method method calculates the hash for string. More...
 
std::string getHashForFile (const std::string &file)
 This method method calculates the hash for a file. More...
 
const std::string & getClientVersion ()
 This method returns the full CrestApi version. More...
 

Private Member Functions

std::string makeUrl (const std::string &address) const
 
nlohmann::json getMgmtInfo ()
 This is an auxiliary method to read the CREST Server properties. More...
 
std::string getCrestVersion () override
 This method returns the full CREST Server version. More...
 
int getMajorVersion (std::string &str)
 This is an auxiliary method to extract a major version number from full version string. More...
 
nlohmann::json getJson (const std::string &str, const char *method) const
 Auxiliary method to convert string in to JSON object. More...
 
std::string parseXMLOutput (const std::string_view xmlBuffer) const
 This method removes all XML/HTML tags from a string. More...
 
std::string removeCR (const std::string &str) const
 This method removes all end of line and carriage return symbols from a string. More...
 
void checkHash (const std::string &hash, const std::string &str, const char *method_name)
 This checks the hash of payload from IOV (hash) with the hash calculated for the payload in the std::string (str) (It is an auxiliary method to check the payload.) More...
 

Private Attributes

std::string m_PATH = DEFAULT_CREST_API_VERSION
 
std::string m_host
 
std::string m_port
 
std::string m_prefix = "http://"
 
Crest::CrestRequest m_request = Crest::CrestRequest()
 

Static Private Attributes

static const std::string s_TAG_PATH = "/tags"
 
static const std::string s_ADMIN_PATH = "/admin"
 
static const std::string s_IOV_PATH = "/iovs"
 
static const std::string s_IOV_SIZE_PATH = "/size"
 
static const std::string s_GLOBALTAG_PATH = "/globaltags"
 
static const std::string s_GLOBALTAG_MAP_PATH = "/globaltagmaps"
 
static const std::string s_PAYLOAD_PATH = "/payloads"
 
static const std::string s_MONITORING_PAYLOAD_PATH = "/monitoring/payloads"
 
static const std::string s_META_PATH = "/meta"
 
static const std::string s_DATA_PATH = "/data"
 
static const std::string s_FOLDER_PATH = "/folders"
 
static const std::string s_RUNINFO_PATH = "/runinfo"
 
static const std::string s_RUNINFO_LIST_PATH = "/list"
 
static const std::string s_METHOD_IOVS = "IOVS"
 
static const std::string s_METHOD_GROUPS = "GROUPS"
 
static const std::string s_MGMT_PATH = "/mgmt"
 
static const std::string s_MGMT_INFO_PATH = "/info"
 
static const std::string s_CREST_CLIENT_VERSION = "5.0"
 
static const std::string s_MGMT_INFO_PATH_2 = "/actuator/info"
 

Detailed Description

Definition at line 32 of file CrestApi.h.

Constructor & Destructor Documentation

◆ CrestClient() [1/2]

Crest::CrestClient::CrestClient ( const std::string &  _host,
const std::string &  _port,
bool  check_version = false 
)

CrestClient constructor.

CrestClient constructor for Internet mode.

Parameters
host- host name of the CREST Server.
port- port of the CREST Server.
check_version- the parameter to switch CREST version checking, if this parameter is true, the CREST version test will be executed.

If CrestClient is created with this method the data will be sent to the CREST Server.

Parameters
_host- host name of the CREST Server.
_port- port of the CREST Server.
check_version- the parameter to switch CREST version checking, if this parameter is true, the CREST version test will be executed.

Definition at line 36 of file CrestApi.cxx.

36  : m_host(_host), m_port(_port)
37  {
38  if (check_version == true)
39  {
41  }
45  }

◆ CrestClient() [2/2]

Crest::CrestClient::CrestClient ( std::string_view  url,
bool  check_version = false 
)

CrestClient constructor.

CrestClient constructor for Internet mode.

Parameters
url- URL address of the CREST Server (with port).
check_version- the parameter to switch CREST version checking, if this parameter is true, the CREST version test will be executed.

Example:

   std::string url = "http://mvg-test-pc-03.cern.ch:8090";
   CrestClient myCrestClient = CrestClient(url);

If CrestClient is created with this method the data will be sent to the CREST Server.

Parameters
url- URL address of the CREST Server (with port).
check_version- the parameter to switch CREST version checking, if this parameter is true, the CREST version test will be executed.

Example:
   std::string url = "http://mvg-test-pc-03.cern.ch:8090";
   CrestClient myCrestClient = CrestClient(url);

Definition at line 61 of file CrestApi.cxx.

62  {
63  size_t found = url.find_first_of(':');
64  size_t n = url.size();
65 
66  std::string_view url_new = url.substr(found + 3); // url_new is the url excluding the http part
67  m_prefix = url.substr(0,found + 3); // URL prefix "http://" or "https://"
68 
69  size_t found1 = url_new.find_first_of(':');
70  size_t found2 = url_new.find_first_of('/');
71 
72  std::string_view host;
73  std::string_view port;
74  std::string_view resources;
75  if (found1 != std::string::npos && found2 != std::string::npos) {
76  host = url_new.substr(0, found1);
77  port = url_new.substr(found1 + 1, found2 - found1 - 1);
78  } else if (found1 != std::string::npos) {
79  host = url_new.substr(0, found1);
80  port = url_new.substr(found1 + 1);
81  } else if (found2 != std::string::npos) {
82  if (m_prefix == "https://") {
83  port = "443";
84  }
85  else port = "80";
86  host = url_new.substr(0, found2);
87  } else {
88  if (m_prefix == "https://") {
89  port = "443";
90  }
91  else port = "80";
92  host = url_new;
93  }
94 
95  if (found2 < n - 1)
96  {
97  resources = url_new.substr(found2, n - 1);
98  m_PATH = resources;
99  }
100 
101  m_port = std::string(port);
102  m_host = std::string(host);
106 
107  if (check_version == true)
108  {
110  }
111  std::cout << "CrestClient::CrestClient: host = " << m_host << ", port = " << m_port << ", path = " << m_PATH << std::endl;
112  }

◆ ~CrestClient()

Crest::CrestClient::~CrestClient ( )

CrestClient destructor.

Definition at line 117 of file CrestApi.cxx.

117 {}

Member Function Documentation

◆ checkCrestVersion()

void Crest::CrestClient::checkCrestVersion ( )

This method is a CREST version test.

It checks if the major CREST server is equal to the major CrestApi vesrion. If the versions are different an error is thrown.

Exceptions
std::runtime_error- error, if the versions are different.

Definition at line 259 of file CrestApi.cxx.

260  {
261  std::string client = getClientVersion();
262  std::string server = getCrestVersion();
263 
264  int clientVersion = getMajorVersion(client);
265  int serverVersion = getMajorVersion(server);
266 
267  if (clientVersion != serverVersion)
268  {
269  throw CrestException("ERROR in CrestClient::checkCrestVersion: CrestApi version \"" + client + "\" does not correspond to the server version \"" + server + "\".");
270  }
271  }

◆ checkHash()

void Crest::CrestClient::checkHash ( const std::string &  hash,
const std::string &  str,
const char *  method_name 
)
private

This checks the hash of payload from IOV (hash) with the hash calculated for the payload in the std::string (str) (It is an auxiliary method to check the payload.)

Parameters
hash- the hash from an IOV.
str- the payload in std::string.

Definition at line 795 of file CrestApi.cxx.

796  {
797  std::string calculatedHash = getHash(str);
798  if (hash != calculatedHash) {
799  throw CrestException("ERROR in " + (std::string)method_name + ": payload is corrupted.");
800  }
801  return;
802  }

◆ createGlobalTag()

void Crest::CrestClient::createGlobalTag ( GlobalTagDto globalTag)
overridevirtual

This method creates a global tag on CREST server.

Parameters
globalTag- global tag as GlobalTagDto.
Example:
 nlohmann::json js =
     {
         {"name", tagname},
         {"validity", 0},
         {"description", "test"},
         {"release", "1"},
         {"insertionTime", "2018-12-18T11:32:58.081+0000"},
         {"snapshotTime", "2018-12-18T11:32:57.952+0000"},
         {"scenario", "test"},
         {"workflow", "M"},
         {"type", "t"},
     };
 GlobalTagDto dto = GlobalTagDto();
 dto = dto.from_json(js);
 myCrestClient.createGlobalTag(dto);

Implements Crest::CrestApiBase.

Definition at line 284 of file CrestApi.cxx.

285  {
286  const char *method_name = "CrestClient::createGlobalTag";
287 
288  std::string current_path = m_PATH;
289  current_path += s_GLOBALTAG_PATH;
290  std::string retv;
291  nlohmann::json js = dto.to_json();
292  retv = m_request.performRequest(current_path, Action::POST, js, method_name);
293  }

◆ createGlobalTagMap()

void Crest::CrestClient::createGlobalTagMap ( GlobalTagMapDto globalTagMap)
overridevirtual

This method creates a global tag map on the CREST server.

Parameters
globalTagMap- the global tag map as GlobalTagMapDto.
Example:
 nlohmann::json js =
 {
   {"globalTagName", globaltag},
   {"record", "testing2"},
   {"label", "test2"},
   {"tagName", tagname}
 };
 GlobalTagMapDto globalTagMap = GlobalTagMapDto();
 globalTagMap = globalTagMap.from_json(js);
 myCrestClient.createGlobalTagMap(globalTagMap);

Implements Crest::CrestApiBase.

Definition at line 554 of file CrestApi.cxx.

555  {
556  const char *method_name = "CrestClient::createGlobalTagMap";
557 
558  std::string current_path = m_PATH;
559  current_path += s_GLOBALTAG_MAP_PATH;
560  std::string retv;
561  nlohmann::json js = dto.to_json();
562  retv = m_request.performRequest(current_path, Action::POST, js, method_name);
563  }

◆ createTag()

void Crest::CrestClient::createTag ( TagDto tag)
overridevirtual

This method creates a tag on the CREST server.

Parameters
tag- tag as TagDto.
 Example:
 nlohmann::json js =
 {
   {"name", tagname},
   {"timeType", "time"},
   {"description", "test"},
   {"synchronization", "none"},
   {"insertionTime", "2018-12-18T11:32:58.081+0000"},
   {"modificationTime", "2018-12-18T11:32:57.952+0000"},
   {"payloadSpec", "JSON"},
   {"lastValidatedTime", 0.},
   {"endOfValidity", 0.},
 };
 TagDto dto = TagDto();
 dto = dto.from_json(js);
 myCrestClient.createTag(dto);
 

Implements Crest::CrestApiBase.

Definition at line 374 of file CrestApi.cxx.

375  {
376  const char *method_name = "CrestClient::createTag";
377 
378  std::string current_path = m_PATH;
379  current_path += s_TAG_PATH;
380  std::string retv;
381  nlohmann::json js = dto.to_json();
382  retv = m_request.performRequest(current_path, Action::POST, js, method_name);
383  }

◆ createTagMeta()

void Crest::CrestClient::createTagMeta ( TagMetaDto tag)
overridevirtual

This method creates a tag meta info on the CREST server.

Parameters
tag- tag meta info as TagMetaDto.
Example:
 nlohmann::json channel = {{"0", "ATLAS_PREFERRED"}};
 nlohmann::json chanList = nlohmann::json::array({channel});
 nlohmann::json tagInfo =
     {
         {"channel_list", chanList},
         {"node_description", "description of the node"},
         {"payload_spec", "stave:Int32, eta:Int32, mag:Float, base:Float, free:Float"}};
 nlohmann::json js =
     {
         {"tagName", tagname},
         {"description", "none"},
         {"chansize", 1},
         {"colsize", 6},
         {"tagInfo", tagInfo.dump()},
         {"insertionTime", "2020-12-04"}};
 TagMetaDto dto = TagMetaDto();
 dto = dto.from_json(js);
 myCrestClient.createTagMeta(dto);

Implements Crest::CrestApiBase.

Definition at line 464 of file CrestApi.cxx.

465  {
466  const char *method_name = "CrestClient::createTagMeta";
467 
468  std::string current_path = m_PATH;
469  current_path += s_TAG_PATH;
470  current_path += '/';
471  current_path += dto.tagName;
472  current_path += s_META_PATH;
473 
474  std::string retv;
475  nlohmann::json js = dto.to_json();
476  retv = m_request.performRequest(current_path, Action::POST, js, method_name);
477  }

◆ findGlobalTag()

GlobalTagDto Crest::CrestClient::findGlobalTag ( const std::string &  name)
overridevirtual

This method finds a global tag by name on the CREST server.

Only one global tag should be returned. (This method is an analogue of the find_global_tag method in Python)

Parameters
name- global tag name,
Returns
global tag as GlobalTagDto.

Implements Crest::CrestApiBase.

Definition at line 295 of file CrestApi.cxx.

296  {
297  const char *method_name = "CrestClient::findGlobalTag";
298 
299  std::string current_path = m_PATH;
300  current_path += s_GLOBALTAG_PATH;
301  current_path += '/';
302  current_path += name;
303  std::string retv;
304 
305  nlohmann::json js = nullptr;
306  retv = m_request.performRequest(current_path, Action::GET, js, method_name);
307  nlohmann::json response = getJson(retv, method_name);
308 
310  std::vector<GlobalTagDto> v = dto.resources;
311  // Only one element is expected:
312  return v[0];
313  }

◆ findGlobalTagMap()

GlobalTagMapSetDto Crest::CrestClient::findGlobalTagMap ( const std::string &  name,
const std::string &  xCrestMapMode 
)
overridevirtual

This method searches for tag mappings using the global tag name or tag name on the CREST server.

(This method is an analogue of the find_global_tag_map method in Python)

Parameters
name- name of a global tag or a tag
xCrestMapMode- search mode (Trace or BackTrace). If it is set as "Trace" the global tag name will be used for searching, otherwise - the tag name.
Returns
global tag map list as GlobalTagMapSetDto.

Implements Crest::CrestApiBase.

Definition at line 565 of file CrestApi.cxx.

566  {
567  const char *method_name = "CrestClient::findGlobalTagMap";
568 
569  std::string current_path = m_PATH;
570  current_path += s_GLOBALTAG_MAP_PATH;
571  current_path += '/';
572  current_path += name;
573  std::string headers_params = "";
574 
575  if (xCrestMapMode != "")
576  {
577  headers_params += "X-Crest-MapMode: ";
578  headers_params += xCrestMapMode;
579  }
580  else
581  {
582  headers_params += "X-Crest-MapMode: ";
583  headers_params += "Trace";
584  }
585  std::string retv;
586  nlohmann::json js = nullptr;
587  retv = m_request.performRequest(current_path, Action::GET, js, method_name, headers_params);
588  nlohmann::json response = getJson(retv, method_name);
590 
591  return dto;
592  }

◆ findTag()

TagDto Crest::CrestClient::findTag ( const std::string &  name)
overridevirtual

This method finds a tag by the name on the CREST server.

(This method is an analogue of the find_tag method in Python)

Parameters
name- tag name
Returns
tag as TagDto object.

Implements Crest::CrestApiBase.

Definition at line 386 of file CrestApi.cxx.

387  {
388  const char *method_name = "CrestClient::findTag";
389 
390  std::string current_path = m_PATH;
391  current_path += s_TAG_PATH;
392  current_path += '/';
393  current_path += name;
394  std::string retv;
395  nlohmann::json js = nullptr;
396  retv = m_request.performRequest(current_path, Action::GET, js, method_name);
397  nlohmann::json response = getJson(retv, method_name);
399 
400  std::vector<TagDto> v = dto.resources;
401  // Only one element is expected:
402  return v[0];
403  }

◆ findTagMeta()

TagMetaDto Crest::CrestClient::findTagMeta ( const std::string &  name)
overridevirtual

This method reads a tag meta info by the tag name from the CREST server.

Parameters
name- tag name
Returns
tag meta info as a TagMetaDto.

Implements Crest::CrestApiBase.

Definition at line 494 of file CrestApi.cxx.

495  {
496  const char *method_name = "CrestClient::findTagMeta";
497 
498  std::string current_path = m_PATH;
499  current_path += s_TAG_PATH;
500  current_path += '/';
501  current_path += name;
502  current_path += s_META_PATH;
503  std::string retv;
504  nlohmann::json js = nullptr;
505  retv = m_request.performRequest(current_path, Action::GET, js, method_name);
506  nlohmann::json response = getJson(retv, method_name);
507 
509  std::vector<TagMetaDto> v = dto.resources;
510  // Only one element is expected:
511  return v[0];
512  }

◆ getClientVersion()

const std::string & Crest::CrestApiBase::getClientVersion ( )
protectedinherited

This method returns the full CrestApi version.

Returns
CrestApi library version.

Definition at line 38 of file CrestApiBase.cxx.

39  {
41  }

◆ getCrestVersion()

std::string Crest::CrestClient::getCrestVersion ( )
overrideprivatevirtual

This method returns the full CREST Server version.

Returns
CREST server version.

Implements Crest::CrestApiBase.

Definition at line 214 of file CrestApi.cxx.

215  {
216 
217  std::string version = "";
218  nlohmann::json buildInfo;
220  // The CREST Server response has the following structure:
221  // { "build": { "artifact": "crestdb", "name": "crest", "version": "4.0", "group": "hep.crest"} }
222  try
223  {
224  buildInfo = info["build"];
225  version = buildInfo["version"];
226  }
227  catch (const std::exception &e)
228  {
229  throw CrestException("ERROR in CrestClient::getCrestVersion: " + to_string(info) + " does not contain version info.");
230  }
231  return version;
232  }

◆ getHash()

std::string Crest::CrestApiBase::getHash ( std::string_view  str)
protectedinherited

This method method calculates the hash for string.

Parameters
str- string.
Returns
hash for a given string.

Definition at line 32 of file CrestApiBase.cxx.

33  {
34  std::string hash_hex_str = picosha2::hash256_hex_string(str.begin(), str.end());
35  return hash_hex_str;
36  }

◆ getHashForFile()

std::string Crest::CrestApiBase::getHashForFile ( const std::string &  file)
protectedinherited

This method method calculates the hash for a file.

Parameters
file- path to the file with the file name..
Returns
hash for a given file.

Definition at line 8 of file CrestApiBase.cxx.

9  {
10  std::ifstream ifs(file);
11  if (!ifs)
12  {
13  throw CrestException(
14  "ERROR in CrestFsClient::getHashForFile cannot open file \"" + file + "\".");
15  }
16 
18  std::vector<char> buffer(1024 * 1024); // use 1M memory
19  while (ifs.read(buffer.data(), static_cast<std::streamsize>(buffer.size())))
20  {
21  std::cout << "#" << std::flush;
22  hasher.process(buffer.begin(), buffer.end());
23  }
24  // process remains
25  hasher.process(buffer.begin(), buffer.begin() + static_cast<int>(ifs.gcount()));
26  hasher.finish();
27 
28  std::string hash = picosha2::get_hash_hex_string(hasher);
29  return hash;
30  }

◆ getJson()

nlohmann::json Crest::CrestClient::getJson ( const std::string &  str,
const char *  method 
) const
private

Auxiliary method to convert string in to JSON object.

CrestClient::getJson method is used to convert the string to the json object.

Parameters
str- string (std::string)
method- method name, which calls this method. This parameter is used to throw an error exception.
Returns
- JSON object as nlohmann::json
Parameters
str- string to be converted to the json object.
method- name of the method which calls this method.
Returns
json object.

Definition at line 169 of file CrestApi.cxx.

170  {
171  nlohmann::json js = nullptr;
172  try
173  {
175  }
176  catch (nlohmann::json::parse_error &e)
177  {
178  if (method == nullptr || *method == '\0')
179  {
180  // method name is undefined
181 
182  std::string wh = e.what();
183  throw CrestException("ERROR in JSON conversion: " + wh + " | In string: " + str);
184  }
185  else
186  {
187  std::string str2 = parseXMLOutput(str); // to remove HTML tags use this function
188  std::string str3 = removeCR(str2); // to remove carridge return
189  throw CrestException("ERROR in " + std::string(method) + " | CREST Server response : " + str3);
190  }
191  }
192  catch (const std::exception &e)
193  {
194  throw CrestException("ERROR in CrestClient::" + (std::string)method + ": " + e.what());
195  }
196  return js;
197  }

◆ getMajorVersion()

int Crest::CrestClient::getMajorVersion ( std::string &  str)
private

This is an auxiliary method to extract a major version number from full version string.

Returns
major version number.

Definition at line 235 of file CrestApi.cxx.

236  {
237  int v = -1;
238  int n = str.find('.');
239 
240  if (n < 1)
241  {
242  throw CrestException("ERROR in CrestClient::getMajorVersion: string \"" + str + "\" does not contain major version.");
243  }
244 
245  std::string vers = str.substr(0, n);
246 
247  try
248  {
249  v = std::stoi(str);
250  }
251  catch (const std::exception &e)
252  {
253  throw CrestException("ERROR in CrestClient::getMajorVersion: string \"" + str + "\" does not contain major version.");
254  }
255 
256  return v;
257  }

◆ getMgmtInfo()

nlohmann::json Crest::CrestClient::getMgmtInfo ( )
private

This is an auxiliary method to read the CREST Server properties.

Returns
JSON with CREST server properties.
Example:
 {
  "build":{
    "artifact":"crestdb",
    "name":"crestdb",
    "time":"2023-12-02T15:21:57.045Z",
    "version":"4.2.1",
    "group":"hep.crest"
  }
 }

Definition at line 199 of file CrestApi.cxx.

200  {
201  const char *method_name = "getMgmtInfo";
202 
203  std::string current_path = s_MGMT_PATH + s_MGMT_INFO_PATH;
204  std::string retv;
205  nlohmann::json js = nullptr;
206 
207  retv = m_request.performRequest(current_path, Action::GET, js, method_name);
208 
209  nlohmann::json respond = getJson(retv, method_name);
210 
211  return respond;
212  }

◆ getPayload()

std::string Crest::CrestClient::getPayload ( const std::string &  hash)
overridevirtual

This method finds a payload resource associated to the hash on the CREST server.

The payload returns as a string. (This method is an analogue of the get_payload method in Python)

Parameters
hash- hash.
Returns
payload as a std::string

Implements Crest::CrestApiBase.

Definition at line 760 of file CrestApi.cxx.

761  {
762  const char *method_name = "CrestClient::getPayload";
763 
764  std::string current_path = m_PATH;
765  current_path += s_PAYLOAD_PATH;
766  current_path += "/data?format=BLOB&hash=";
767  current_path += hash;
768  std::string retv;
769  nlohmann::json js = nullptr;
770  retv = m_request.performRequest(current_path, Action::GET, js, method_name);
771  checkHash(hash, retv, method_name);
772  return retv;
773  }

◆ getPayloadMeta()

PayloadDto Crest::CrestClient::getPayloadMeta ( const std::string &  hash)
overridevirtual

This method finds a payload meta info for the hash on the CREST server.

(This method is an analogue of the get_payload_meta method in Python)

Parameters
hash- hash.
Returns
payload meta info as PayloadDto.

Implements Crest::CrestApiBase.

Definition at line 775 of file CrestApi.cxx.

776  {
777  const char *method_name = "CrestClient::getPayloadMeta";
778 
779  std::string current_path = m_PATH;
780  current_path += s_PAYLOAD_PATH;
781  current_path += '/';
782  current_path += hash;
783  current_path += "?format=META";
784  std::string retv;
785  nlohmann::json js = nullptr;
786  retv = m_request.performRequest(current_path, Action::GET, js, method_name);
787  nlohmann::json response = getJson(retv, method_name);
788 
790  std::vector<PayloadDto> v = dto.resources;
791  // Only one element is expected:
792  return v[0];
793  }

◆ getSize()

int Crest::CrestClient::getSize ( const std::string &  tagname)
overridevirtual

This method gets the number of IOVs for the given tag.

(This method is an analogue of the get_size method in Python)

Parameters
tagname- tag name.
Returns
IOV number.

Implements Crest::CrestApiBase.

Definition at line 515 of file CrestApi.cxx.

516  {
517  const char *method_name = "CrestClient::getSize";
518 
519  std::string current_path = m_PATH;
520  current_path += s_IOV_PATH;
521  current_path += s_IOV_SIZE_PATH;
522  current_path += "?tagname=";
523  current_path += tagname;
524 
525  std::string retv;
526 
527  nlohmann::json js = nullptr;
528  retv = m_request.performRequest(current_path, Action::GET, js, method_name);
529  nlohmann::json respond = getJson(retv, method_name);
530 
531  auto res = respond.find("resources");
533 
534  if (res != respond.end())
535  {
536  r = respond["resources"][0];
537  }
538 
539  int result = 0;
540  if (r.find("niovs") != r.end())
541  {
542  result = r["niovs"];
543  }
544  else
545  {
546  throw CrestException("ERROR in CrestClient::getSize CREST Server JSON response has no \"size\" key.");
547  }
548 
549  return result;
550  }

◆ listGlobalTags()

GlobalTagSetDto Crest::CrestClient::listGlobalTags ( const std::string &  name,
int  size,
int  page,
const std::string &  sort 
)
overridevirtual

This method finds the global tags on the CREST server.

Parameters
name- global tag name pattern, "%" can be used for any symbols,
size- page size,
page- page number,
sort- sorting order (name:ASC or name:DESC),
Returns
global tag list as GlobalTagSetDto.

Implements Crest::CrestApiBase.

Definition at line 315 of file CrestApi.cxx.

316  {
317  const char *method_name = "CrestClient::listGlobalTags";
318 
319  std::string current_path = m_PATH;
320  current_path += s_GLOBALTAG_PATH;
321  current_path += '?';
322  if (name != "")
323  {
324  current_path += "name=";
325  current_path += name;
326  current_path += '&';
327  }
328  if (size != -1)
329  {
330  current_path += "size=";
331  current_path += std::to_string(size);
332  current_path += '&';
333  }
334  if (page != -1)
335  {
336  current_path += "page=";
337  current_path += std::to_string(page);
338  current_path += '&';
339  }
340  if (sort != "")
341  {
342  current_path += "sort=";
343  current_path += sort;
344  current_path += '&';
345  }
346  std::string retv;
347 
348  nlohmann::json js = nullptr;
349  retv = m_request.performRequest(current_path, Action::GET, js, method_name);
350  nlohmann::json response = getJson(retv, method_name);
351 
353 
354  return dto;
355  }

◆ listTags()

TagSetDto Crest::CrestClient::listTags ( const std::string &  name,
int  size,
int  page,
const std::string &  sort 
)
overridevirtual

This method returns the tag list as TagSetDto from the CREST server.

(This method is an analogue of the list_tags method in Python)

Parameters
name- tag name pattern,
size- page size,
page- page number,
sort- sorting order (name:ASC or name:DESC).
Returns
tag list as TagSetDto object.

Implements Crest::CrestApiBase.

Definition at line 405 of file CrestApi.cxx.

406  {
407  const char *method_name = "CrestClient::listTags";
408 
409  std::string current_path = m_PATH;
410  current_path += s_TAG_PATH;
411  current_path += '?';
412  if (name != "")
413  {
414  current_path += "name=";
415  current_path += name;
416  current_path += '&';
417  }
418  if (size != -1)
419  {
420  current_path += "size=";
421  current_path += std::to_string(size);
422  current_path += '&';
423  }
424  if (page != -1)
425  {
426  current_path += "page=";
427  current_path += std::to_string(page);
428  current_path += '&';
429  }
430  if (sort != "")
431  {
432  current_path += "sort=";
433  current_path += sort;
434  current_path += '&';
435  }
436  std::string retv;
437 
438  nlohmann::json js = nullptr;
439  retv = m_request.performRequest(current_path, Action::GET, js, method_name);
440  nlohmann::json response = getJson(retv, method_name);
441 
443 
444  return dto;
445  }

◆ makeUrl()

std::string Crest::CrestClient::makeUrl ( const std::string &  address) const
private

Definition at line 273 of file CrestApi.cxx.

274  {
275  std::string str = m_prefix;
276  str += m_host;
277  str += ':';
278  str += m_port;
279  str += address;
280  return str;
281  }

◆ parseXMLOutput()

std::string Crest::CrestClient::parseXMLOutput ( const std::string_view  xmlBuffer) const
private

This method removes all XML/HTML tags from a string.

(It is an auxiliary method to clear the CREST Server response.)

Parameters
xmlBuffer- the text (a std::string ) to be cleared.

Definition at line 121 of file CrestApi.cxx.

122  {
123  bool copy = true;
124 
125  std::string plainString = "";
126 
127  // remove all xml tags
128  for (long unsigned int i = 0; i < xmlBuffer.length(); i++)
129  {
130  char convertc = xmlBuffer[i];
131 
132  if (convertc == '<')
133  copy = false;
134  else if (convertc == '>')
135  {
136  copy = true;
137  continue;
138  }
139 
140  if (copy)
141  plainString += convertc;
142  }
143 
144  return plainString;
145  }

◆ removeCR()

std::string Crest::CrestClient::removeCR ( const std::string &  str) const
private

This method removes all end of line and carriage return symbols from a string.

(It is an auxiliary method to clear the CREST Server response.)

Parameters
str- the text (a std::string ) to be cleared.

Definition at line 149 of file CrestApi.cxx.

150  {
151  std::string str2 = str;
152  std::replace(str2.begin(), str2.end(), '\n', '|');
153  char needle = '\r';
154  size_t pos;
155  while ((pos = str2.find(needle)) != str2.npos)
156  {
157  str2.erase(pos, 1);
158  }
159  return str2;
160  }

◆ removeGlobalTag()

void Crest::CrestClient::removeGlobalTag ( const std::string &  name)
overridevirtual

This method removes a global tag on the CREST server.

(This method is an analogue of the remove_global_tag method in Python)

Parameters
name- global tag name

Implements Crest::CrestApiBase.

Definition at line 358 of file CrestApi.cxx.

359  {
360  const char *method_name = "CrestClient::removeGlobalTag";
361 
362  std::string current_path = m_PATH;
363  current_path += s_ADMIN_PATH;
364  current_path += s_GLOBALTAG_PATH;
365  current_path += '/';
366  current_path += name;
367  std::string retv;
368  nlohmann::json js = nullptr;
369  retv = m_request.performRequest(current_path, Action::DELETE, js, method_name);
370  }

◆ removeGlobalTagMap()

void Crest::CrestClient::removeGlobalTagMap ( const std::string &  name,
const std::string &  record,
const std::string &  label,
const std::string &  tagname 
)
overridevirtual

This method removes a global tag map on the CREST server.

Parameters
name- the global tag name,
label- label,
tagname- tag name.

Implements Crest::CrestApiBase.

Definition at line 594 of file CrestApi.cxx.

595  {
596  const char *method_name = "CrestClient::removeGlobalTagMap";
597 
598  std::string current_path = m_PATH;
599  current_path += s_GLOBALTAG_MAP_PATH;
600  current_path += '/';
601  current_path += name;
602  current_path += '?';
603  if (tagname != "")
604  {
605  current_path += "tagname=";
606  current_path += tagname;
607  current_path += '&';
608  }
609  if (record != "")
610  {
611  current_path += "record=";
612  current_path += record;
613  current_path += '&';
614  }
615  if (label != "")
616  {
617  current_path += "label=";
618  current_path += label;
619  current_path += '&';
620  }
621 
622  std::string retv;
623  nlohmann::json js = nullptr;
624  retv = m_request.performRequest(current_path, Action::DELETE, js, method_name);
625  }

◆ removeTag()

void Crest::CrestClient::removeTag ( const std::string &  name)
overridevirtual

This method removes a tag from the CREST server.

(This method is an analogue of the remove_tag method in Python)

Parameters
tagName- tag name

Implements Crest::CrestApiBase.

Definition at line 448 of file CrestApi.cxx.

449  {
450  const char *method_name = "CrestClient::removeTag";
451 
452  std::string current_path = m_PATH;
453  current_path += s_ADMIN_PATH;
454  current_path += s_TAG_PATH;
455  current_path += '/';
456  current_path += name;
457  std::string retv;
458  nlohmann::json js = nullptr;
459  retv = m_request.performRequest(current_path, Action::DELETE, js, method_name);
460  }

◆ selectGroups()

IovSetDto Crest::CrestClient::selectGroups ( const std::string &  name,
long  snapshot,
int  size,
int  page,
const std::string &  sort 
)
overridevirtual

This method returns IOV groups for a given tagname on CREST server.

The result is an IOV list. (This method is an analogue of the select_groups method in Python)

Parameters
name- tag name,
snapshot- snapshot,
size- page size,
page- page number,
sort- sorting order (id.since:ASC or id.since:DESC)
Returns
an IOV groups as IovSetDto.

Implements Crest::CrestApiBase.

Definition at line 674 of file CrestApi.cxx.

675  {
676  const char *method_name = "CrestClient::selectGroups";
677 
678  std::string current_path = m_PATH;
679  current_path += s_IOV_PATH;
680 
681  current_path += "?method=";
682  current_path += s_METHOD_GROUPS;
683  current_path += "&tagname=";
684 
685  current_path += name;
686  current_path += "&snapshot=";
687  current_path += std::to_string(snapshot);
688 
689  //
690  current_path += "&size=";
691  current_path += std::to_string(size);
692  current_path += "&page=";
693  current_path += std::to_string(page);
694  current_path += "&sort=";
695  current_path += sort;
696  //
697 
698  std::string retv;
699 
700  nlohmann::json js = nullptr;
701  retv = m_request.performRequest(current_path, Action::GET, js, method_name);
702  nlohmann::json response = getJson(retv, method_name);
703 
705 
706  return dto;
707  }

◆ selectIovs()

IovSetDto Crest::CrestClient::selectIovs ( const std::string &  name,
uint64_t  since,
uint64_t  until,
long  snapshot,
int  size,
int  page,
const std::string &  sort 
)
overridevirtual

This method selects IOVs for a given tagname on the CREST server.

The result is an IOV list. (This method is an analogue of the select_iovs method in Python)

Parameters
name- tag name,
since- since time (the beginning of the time interval),
until- until time (end of the time interval),
snapshot- snapshot,
size- page size,
page- page number,
sort- sorting order (id.since:ASC or id.since:DESC)
Returns
an IOV list as IovSetDto.

Implements Crest::CrestApiBase.

Definition at line 629 of file CrestApi.cxx.

630  {
631  const char *method_name = "CrestClient::selectIovs";
632 
633  std::string current_path = m_PATH;
634  current_path += s_IOV_PATH;
635 
636  current_path += "?method=";
637  current_path += s_METHOD_IOVS;
638  current_path += "&tagname=";
639 
640  current_path += name;
641  current_path += "&since=";
642  current_path += std::to_string(since);
643  current_path += "&until=";
644  if (until == static_cast<uint64_t>(-1))
645  {
646  current_path += "INF";
647  }
648  else
649  {
650  current_path += std::to_string(until);
651  }
652  current_path += "&snapshot=";
653  current_path += std::to_string(snapshot);
654  //
655  current_path += "&size=";
656  current_path += std::to_string(size);
657  current_path += "&page=";
658  current_path += std::to_string(page);
659  current_path += "&sort=";
660  current_path += sort;
661  //
662 
663  std::string retv;
664 
665  nlohmann::json js = nullptr;
666  retv = m_request.performRequest(current_path, Action::GET, js, method_name);
667  nlohmann::json response = getJson(retv, method_name);
668 
670 
671  return dto;
672  }

◆ storeData()

void Crest::CrestClient::storeData ( const std::string &  tag,
const StoreSetDto storeSetJson,
const std::string &  payloadFormat = "JSON",
const std::string &  objectType = "none",
const std::string &  compressionType = "none",
const std::string &  version = "1.0",
uint64_t  endTime = -1 
)
overridevirtual

This method stores several payloads in batch mode on the CREST server.

(This method is an analogue of the store_data method in Python)

Parameters
tag- tag name.
storeSetJson- iov and payload data as a JSON object.
payloadFormat- payload format [FILE | JSON].
objectType- object type.
compressionType- compression type.
version- version.
endTime- end time, if endtime = 0, the server does not use this parameter in the internal check.
Example how to use these parameters:
   std::string tag = "test_MvG3a";
   uint64_t endtime = 200;
   std::string objectType = "test";
   std::string compressionType = "none";
   std::string version = "1.0";
   std::string payloadFormat = "JSON";
   std::string jsonString = R"({"size": 1, "datatype": "data", "format": "StoreSetDto", "resources": [{"since": 1000,"data": "Sample data","streamerInfo": "Info123"}]})";
   StoreSetDto storeSetJson = StoreSetDto::from_json(jsonString);

Implements Crest::CrestApiBase.

Definition at line 711 of file CrestApi.cxx.

718  {
719 
720  std::string current_path = m_PATH;
721  current_path += s_PAYLOAD_PATH;
722  std::vector<std::string> files;
723  std::string retv;
724  nlohmann::json js = storeSetJson.to_json();
725  if (payloadFormat == "JSON")
726  {
727  retv = m_request.uploadPayload(current_path, tag, endTime, js, objectType, compressionType, version, files);
728  }
729  else
730  {
731  // Assumes the data content in the JSON is just a file path.
732  nlohmann::json resources = nullptr;
733 
734  auto subjectIdIter1 = js.find("resources");
735  if (subjectIdIter1 != js.end())
736  {
737  resources = js["resources"];
738  }
739  int partN = resources.size();
740  for (int i = 0; i < partN; i++)
741  {
742  nlohmann::json element = resources[i];
743  std::string file_param;
744 
745  auto subjectIdIter1 = element.find("data");
746  if (subjectIdIter1 != element.end())
747  {
748  file_param = element["data"];
749  }
750  //
751  int found_dots = file_param.find_first_of(':');
752  int word_size = file_param.size();
753  std::string data_file = file_param.substr(found_dots + 3, word_size);
754  files.push_back(data_file);
755  }
756  retv = m_request.uploadPayload(current_path, tag, endTime, js, objectType, compressionType, version, files);
757  }
758  }

◆ updateTagMeta()

void Crest::CrestClient::updateTagMeta ( TagMetaDto tag)
overridevirtual

This method updates a tag meta info on the CREST server.

Parameters
tag- tag meta info as TagMetaDto.

Implements Crest::CrestApiBase.

Definition at line 479 of file CrestApi.cxx.

480  {
481  const char *method_name = "CrestClient::updateTagMeta";
482 
483  std::string current_path = m_PATH;
484  current_path += s_TAG_PATH;
485  current_path += '/';
486  current_path += dto.tagName;
487  current_path += s_META_PATH;
488 
489  std::string retv;
490  nlohmann::json js = dto.to_json();
491  retv = m_request.performRequest(current_path, Action::PUT, js, method_name);
492  }

Member Data Documentation

◆ m_host

std::string Crest::CrestClient::m_host
private

Definition at line 67 of file CrestApi.h.

◆ m_PATH

std::string Crest::CrestClient::m_PATH = DEFAULT_CREST_API_VERSION
private

Definition at line 37 of file CrestApi.h.

◆ m_port

std::string Crest::CrestClient::m_port
private

Definition at line 68 of file CrestApi.h.

◆ m_prefix

std::string Crest::CrestClient::m_prefix = "http://"
private

Definition at line 69 of file CrestApi.h.

◆ m_request

Crest::CrestRequest Crest::CrestClient::m_request = Crest::CrestRequest()
private

Definition at line 71 of file CrestApi.h.

◆ s_ADMIN_PATH

const std::string Crest::CrestClient::s_ADMIN_PATH = "/admin"
inlinestaticprivate

Definition at line 40 of file CrestApi.h.

◆ s_CREST_CLIENT_CHECK

const bool Crest::CrestClient::s_CREST_CLIENT_CHECK = false
inlinestatic

Definition at line 168 of file CrestApi.h.

◆ s_CREST_CLIENT_VERSION

const std::string Crest::CrestClient::s_CREST_CLIENT_VERSION = "5.0"
inlinestaticprivate

Definition at line 62 of file CrestApi.h.

◆ s_DATA_PATH

const std::string Crest::CrestClient::s_DATA_PATH = "/data"
inlinestaticprivate

Definition at line 50 of file CrestApi.h.

◆ s_FOLDER_PATH

const std::string Crest::CrestClient::s_FOLDER_PATH = "/folders"
inlinestaticprivate

Definition at line 52 of file CrestApi.h.

◆ s_GLOBALTAG_MAP_PATH

const std::string Crest::CrestClient::s_GLOBALTAG_MAP_PATH = "/globaltagmaps"
inlinestaticprivate

Definition at line 46 of file CrestApi.h.

◆ s_GLOBALTAG_PATH

const std::string Crest::CrestClient::s_GLOBALTAG_PATH = "/globaltags"
inlinestaticprivate

Definition at line 45 of file CrestApi.h.

◆ s_IOV_PATH

const std::string Crest::CrestClient::s_IOV_PATH = "/iovs"
inlinestaticprivate

Definition at line 41 of file CrestApi.h.

◆ s_IOV_SIZE_PATH

const std::string Crest::CrestClient::s_IOV_SIZE_PATH = "/size"
inlinestaticprivate

Definition at line 43 of file CrestApi.h.

◆ s_META_PATH

const std::string Crest::CrestClient::s_META_PATH = "/meta"
inlinestaticprivate

Definition at line 49 of file CrestApi.h.

◆ s_METHOD_GROUPS

const std::string Crest::CrestClient::s_METHOD_GROUPS = "GROUPS"
inlinestaticprivate

Definition at line 57 of file CrestApi.h.

◆ s_METHOD_IOVS

const std::string Crest::CrestClient::s_METHOD_IOVS = "IOVS"
inlinestaticprivate

Definition at line 56 of file CrestApi.h.

◆ s_MGMT_INFO_PATH

const std::string Crest::CrestClient::s_MGMT_INFO_PATH = "/info"
inlinestaticprivate

Definition at line 61 of file CrestApi.h.

◆ s_MGMT_INFO_PATH_2

const std::string Crest::CrestClient::s_MGMT_INFO_PATH_2 = "/actuator/info"
inlinestaticprivate

Definition at line 63 of file CrestApi.h.

◆ s_MGMT_PATH

const std::string Crest::CrestClient::s_MGMT_PATH = "/mgmt"
inlinestaticprivate

Definition at line 60 of file CrestApi.h.

◆ s_MONITORING_PAYLOAD_PATH

const std::string Crest::CrestClient::s_MONITORING_PAYLOAD_PATH = "/monitoring/payloads"
inlinestaticprivate

Definition at line 48 of file CrestApi.h.

◆ s_PAYLOAD_PATH

const std::string Crest::CrestClient::s_PAYLOAD_PATH = "/payloads"
inlinestaticprivate

Definition at line 47 of file CrestApi.h.

◆ s_RUNINFO_LIST_PATH

const std::string Crest::CrestClient::s_RUNINFO_LIST_PATH = "/list"
inlinestaticprivate

Definition at line 54 of file CrestApi.h.

◆ s_RUNINFO_PATH

const std::string Crest::CrestClient::s_RUNINFO_PATH = "/runinfo"
inlinestaticprivate

Definition at line 53 of file CrestApi.h.

◆ s_TAG_PATH

const std::string Crest::CrestClient::s_TAG_PATH = "/tags"
inlinestaticprivate

Definition at line 39 of file CrestApi.h.


The documentation for this class was generated from the following files:
RunTileTBRec.method
method
Definition: RunTileTBRec.py:73
grepfile.info
info
Definition: grepfile.py:38
GlobalTagMapSetDto::from_json
static GlobalTagMapSetDto from_json(const json &j)
Definition: CrestModel.cxx:264
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
Crest::CrestClient::s_TAG_PATH
static const std::string s_TAG_PATH
Definition: CrestApi.h:39
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
beamspotman.r
def r
Definition: beamspotman.py:676
Crest::CrestClient::getJson
nlohmann::json getJson(const std::string &str, const char *method) const
Auxiliary method to convert string in to JSON object.
Definition: CrestApi.cxx:169
picosha2::get_hash_hex_string
void get_hash_hex_string(const hash256_one_by_one &hasher, std::string &hex_str)
Definition: picosha2.h:281
Crest::CrestClient::s_MGMT_INFO_PATH
static const std::string s_MGMT_INFO_PATH
Definition: CrestApi.h:61
get_generator_info.result
result
Definition: get_generator_info.py:21
Crest::Action::POST
@ POST
FullCPAlgorithmsTest_eljob.flush
flush
Definition: FullCPAlgorithmsTest_eljob.py:182
json
nlohmann::json json
Definition: HistogramDef.cxx:9
response
MDT_Response response
Definition: MDT_ResponseTest.cxx:28
GlobalTagSetDto::resources
std::vector< GlobalTagDto > resources
Definition: CrestModel.h:83
Crest::CrestClient::s_ADMIN_PATH
static const std::string s_ADMIN_PATH
Definition: CrestApi.h:40
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
PayloadSetDto::resources
std::vector< PayloadDto > resources
Definition: CrestModel.h:368
Crest::CrestClient::s_IOV_PATH
static const std::string s_IOV_PATH
Definition: CrestApi.h:41
parse
std::map< std::string, std::string > parse(const std::string &list)
Definition: egammaLayerRecalibTool.cxx:1054
picosha2::hash256_hex_string
void hash256_hex_string(InIter first, InIter last, std::string &hex_str)
Definition: picosha2.h:353
Crest::Action::DELETE
@ DELETE
Crest::CrestClient::s_METHOD_IOVS
static const std::string s_METHOD_IOVS
Definition: CrestApi.h:56
Crest::CrestRequest::performRequest
std::string performRequest(const std::string &current_path, Action action, nlohmann::json &js, const std::string &header_params="")
General auxiliary method to make request to the CREST Server.
picosha2::hash256_one_by_one::finish
void finish()
Definition: picosha2.h:207
Crest::CrestClient::s_GLOBALTAG_MAP_PATH
static const std::string s_GLOBALTAG_MAP_PATH
Definition: CrestApi.h:46
Crest::CrestRequest::uploadPayload
std::string uploadPayload(const std::string &current_path, const std::string &tag, uint64_t endtime, const nlohmann::json &js, const std::string &objectType, const std::string &compressionType, const std::string &version, const std::vector< std::string > &files)
Definition: CrestRequest.cxx:241
TagSetDto
Definition: CrestModel.h:126
Crest::CrestClient::m_host
std::string m_host
Definition: CrestApi.h:67
Crest::CrestClient::m_PATH
std::string m_PATH
Definition: CrestApi.h:37
Crest::CrestRequest::setPrefix
void setPrefix(const std::string &prefix)
Definition: CrestRequest.cxx:43
GlobalTagSetDto
Definition: CrestModel.h:81
Crest::CrestApiBase::getHash
std::string getHash(std::string_view str)
This method method calculates the hash for string.
Definition: CrestApiBase.cxx:32
physics_parameters.url
string url
Definition: physics_parameters.py:27
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:554
hotSpotInTAG.objectType
objectType
Definition: hotSpotInTAG.py:107
dq_defect_copy_defect_database.since
def since
Definition: dq_defect_copy_defect_database.py:54
rerun_display.client
client
Definition: rerun_display.py:31
Crest::Action::GET
@ GET
Crest::CrestRequest::setHost
void setHost(const std::string &host)
Definition: CrestRequest.cxx:33
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::CrestClient::s_GLOBALTAG_PATH
static const std::string s_GLOBALTAG_PATH
Definition: CrestApi.h:45
TagSetDto::resources
std::vector< TagDto > resources
Definition: CrestModel.h:128
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
Crest::CrestClient::s_META_PATH
static const std::string s_META_PATH
Definition: CrestApi.h:49
defineDB.tagname
string tagname
Definition: JetTagCalibration/share/defineDB.py:19
Crest::CrestClient::s_METHOD_GROUPS
static const std::string s_METHOD_GROUPS
Definition: CrestApi.h:57
lumiFormat.i
int i
Definition: lumiFormat.py:85
Crest::CrestClient::s_MGMT_PATH
static const std::string s_MGMT_PATH
Definition: CrestApi.h:60
beamspotman.n
n
Definition: beamspotman.py:731
Crest::CrestClient::getCrestVersion
std::string getCrestVersion() override
This method returns the full CREST Server version.
Definition: CrestApi.cxx:214
generateReferenceFile.files
files
Definition: generateReferenceFile.py:12
TagMetaSetDto
Definition: CrestModel.h:257
calibdata.exception
exception
Definition: calibdata.py:496
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
PayloadSetDto::from_json
static PayloadSetDto from_json(const json &j)
Definition: CrestModel.cxx:658
file
TFile * file
Definition: tile_monitor.h:29
parseDir.wh
wh
Definition: parseDir.py:46
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
GlobalTagMapSetDto
Definition: CrestModel.h:160
picosha2::hash256_one_by_one::process
void process(RaIter first, RaIter last)
Definition: picosha2.h:196
picosha2::hash256_one_by_one
Definition: picosha2.h:184
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Crest::Action::PUT
@ PUT
Crest::CrestClient::s_PAYLOAD_PATH
static const std::string s_PAYLOAD_PATH
Definition: CrestApi.h:47
PayloadSetDto
Definition: CrestModel.h:366
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
Crest::CrestClient::checkCrestVersion
void checkCrestVersion()
This method is a CREST version test.
Definition: CrestApi.cxx:259
Crest::CrestClient::getMgmtInfo
nlohmann::json getMgmtInfo()
This is an auxiliary method to read the CREST Server properties.
Definition: CrestApi.cxx:199
IovSetDto::from_json
static IovSetDto from_json(const json &j)
Definition: CrestModel.cxx:518
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
Crest::CrestClient::m_prefix
std::string m_prefix
Definition: CrestApi.h:69
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
MyPlots.page
page
Definition: MyPlots.py:234
python.PyAthena.v
v
Definition: PyAthena.py:154
get_generator_info.version
version
Definition: get_generator_info.py:33
Crest::CrestClient::m_port
std::string m_port
Definition: CrestApi.h:68
Crest::CrestClient::m_request
Crest::CrestRequest m_request
Definition: CrestApi.h:71
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
StoreSetDto::to_json
json to_json() const
Definition: CrestModel.cxx:576
Crest::CrestClient::parseXMLOutput
std::string parseXMLOutput(const std::string_view xmlBuffer) const
This method removes all XML/HTML tags from a string.
Definition: CrestApi.cxx:121
IovSetDto
Definition: CrestModel.h:287
TagSetDto::from_json
static TagSetDto from_json(const json &j)
Definition: CrestModel.cxx:223
Crest::CrestApiBase::getClientVersion
const std::string & getClientVersion()
This method returns the full CrestApi version.
Definition: CrestApiBase.cxx:38
Crest::CrestClient::getMajorVersion
int getMajorVersion(std::string &str)
This is an auxiliary method to extract a major version number from full version string.
Definition: CrestApi.cxx:235
tagname
Definition: tagname.h:29
Crest::CrestClient::checkHash
void checkHash(const std::string &hash, const std::string &str, const char *method_name)
This checks the hash of payload from IOV (hash) with the hash calculated for the payload in the std::...
Definition: CrestApi.cxx:795
TagMetaSetDto::resources
std::vector< TagMetaDto > resources
Definition: CrestModel.h:259
str
Definition: BTagTrackIpAccessor.cxx:11
Crest::CrestClient::removeCR
std::string removeCR(const std::string &str) const
This method removes all end of line and carriage return symbols from a string.
Definition: CrestApi.cxx:149
calibdata.copy
bool copy
Definition: calibdata.py:27
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
python.html.AtlRunQueryDQSummary.server
server
Definition: AtlRunQueryDQSummary.py:22
Crest::CrestApiBase::s_CREST_CLIENT_VERSION
static const std::string s_CREST_CLIENT_VERSION
Definition: CrestApiBase.h:36
GlobalTagSetDto::from_json
static GlobalTagSetDto from_json(const json &j)
Definition: CrestModel.cxx:113
TagMetaSetDto::from_json
static TagMetaSetDto from_json(const json &j)
Definition: CrestModel.cxx:432
Crest::CrestRequest::setPort
void setPort(const std::string &port)
Definition: CrestRequest.cxx:38
lumiFormat.endTime
endTime
Definition: lumiFormat.py:100
Crest::CrestClient::s_IOV_SIZE_PATH
static const std::string s_IOV_SIZE_PATH
Definition: CrestApi.h:43