|
ATLAS Offline Software
|
#include <CrestApi.h>
|
| 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...
|
|
Definition at line 32 of file CrestApi.h.
◆ 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.
38 if (check_version ==
true)
◆ 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.
63 size_t found =
url.find_first_of(
':');
64 size_t n =
url.size();
66 std::string_view url_new =
url.substr(
found + 3);
69 size_t found1 = url_new.find_first_of(
':');
70 size_t found2 = url_new.find_first_of(
'/');
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) {
86 host = url_new.substr(0, found2);
97 resources = url_new.substr(found2,
n - 1);
101 m_port = std::string(port);
102 m_host = std::string(host);
107 if (check_version ==
true)
111 std::cout <<
"CrestClient::CrestClient: host = " <<
m_host <<
", port = " <<
m_port <<
", path = " <<
m_PATH << std::endl;
◆ ~CrestClient()
Crest::CrestClient::~CrestClient |
( |
| ) |
|
◆ 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 263 of file CrestApi.cxx.
271 if (clientVersion != serverVersion)
273 throw CrestException(
"ERROR in CrestClient::checkCrestVersion: CrestApi version \"" +
client +
"\" does not correspond to the server version \"" +
server +
"\".");
◆ createGlobalTag()
void Crest::CrestClient::createGlobalTag |
( |
GlobalTagDto & |
globalTag | ) |
|
|
overridevirtual |
This method creates a global tag on CREST server.
- Parameters
-
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 288 of file CrestApi.cxx.
290 const char *method_name =
"CrestClient::createGlobalTag";
292 std::string current_path =
m_PATH;
◆ createGlobalTagMap()
void Crest::CrestClient::createGlobalTagMap |
( |
GlobalTagMapDto & |
globalTagMap | ) |
|
|
overridevirtual |
This method creates a global tag map on the CREST server.
- Parameters
-
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 558 of file CrestApi.cxx.
560 const char *method_name =
"CrestClient::createGlobalTagMap";
562 std::string current_path =
m_PATH;
◆ createTag()
void Crest::CrestClient::createTag |
( |
TagDto & |
tag | ) |
|
|
overridevirtual |
This method creates a tag on the CREST server.
- Parameters
-
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 378 of file CrestApi.cxx.
380 const char *method_name =
"CrestClient::createTag";
382 std::string current_path =
m_PATH;
◆ createTagMeta()
void Crest::CrestClient::createTagMeta |
( |
TagMetaDto & |
tag | ) |
|
|
overridevirtual |
This method creates a tag meta info on the CREST server.
- Parameters
-
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 468 of file CrestApi.cxx.
470 const char *method_name =
"CrestClient::createTagMeta";
472 std::string current_path =
m_PATH;
475 current_path += dto.tagName;
◆ findGlobalTag()
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
-
- Returns
- global tag as GlobalTagDto.
Implements Crest::CrestApiBase.
Definition at line 299 of file CrestApi.cxx.
301 const char *method_name =
"CrestClient::findGlobalTag";
303 std::string current_path =
m_PATH;
306 current_path +=
name;
◆ findGlobalTagMap()
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 569 of file CrestApi.cxx.
571 const char *method_name =
"CrestClient::findGlobalTagMap";
573 std::string current_path =
m_PATH;
576 current_path +=
name;
577 std::string headers_params =
"";
579 if (xCrestMapMode !=
"")
581 headers_params +=
"X-Crest-MapMode: ";
582 headers_params += xCrestMapMode;
586 headers_params +=
"X-Crest-MapMode: ";
587 headers_params +=
"Trace";
◆ 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
-
- Returns
- tag as TagDto object.
Implements Crest::CrestApiBase.
Definition at line 390 of file CrestApi.cxx.
392 const char *method_name =
"CrestClient::findTag";
394 std::string current_path =
m_PATH;
397 current_path +=
name;
◆ findTagMeta()
This method reads a tag meta info by the tag name from the CREST server.
- Parameters
-
- Returns
- tag meta info as a TagMetaDto.
Implements Crest::CrestApiBase.
Definition at line 498 of file CrestApi.cxx.
500 const char *method_name =
"CrestClient::findTagMeta";
502 std::string current_path =
m_PATH;
505 current_path +=
name;
◆ getClientVersion()
std::string Crest::CrestClient::getClientVersion |
( |
| ) |
|
|
private |
This method returns the full CrestApi version.
- Returns
- CrestApi library version.
Definition at line 234 of file CrestApi.cxx.
◆ getCrestVersion()
std::string Crest::CrestClient::getCrestVersion |
( |
| ) |
|
|
private |
This method returns the full CREST Server version.
- Returns
- CREST server version.
Definition at line 214 of file CrestApi.cxx.
224 buildInfo =
info[
"build"];
225 version = buildInfo[
"version"];
229 throw CrestException(
"ERROR in CrestClient::getCrestVersion: " +
to_string(
info) +
" does not contain version info.");
◆ getJson()
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.
176 catch (nlohmann::json::parse_error &
e)
182 std::string
wh =
e.what();
183 throw CrestException(
"ERROR in JSON conversion: " +
wh +
" | In string: " +
str);
189 throw CrestException(
"ERROR in " + std::string(
method) +
" | CREST Server response : " + str3);
194 throw CrestException(
"ERROR in CrestClient::" + (std::string)
method +
": " +
e.what());
◆ 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 239 of file CrestApi.cxx.
242 int n =
str.find(
'.');
246 throw CrestException(
"ERROR in CrestClient::getMajorVersion: string \"" +
str +
"\" does not contain major version.");
249 std::string vers =
str.substr(0,
n);
257 throw CrestException(
"ERROR in CrestClient::getMajorVersion: string \"" +
str +
"\" does not contain major version.");
◆ getMgmtInfo()
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.
201 const char *method_name =
"getMgmtInfo";
◆ 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
-
- Returns
- payload as a std::string
Implements Crest::CrestApiBase.
Definition at line 764 of file CrestApi.cxx.
766 const char *method_name =
"CrestClient::getPayload";
768 std::string current_path =
m_PATH;
770 current_path +=
"/data?format=BLOB&hash=";
771 current_path +=
hash;
◆ getPayloadMeta()
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
-
- Returns
- payload meta info as PayloadDto.
Implements Crest::CrestApiBase.
Definition at line 778 of file CrestApi.cxx.
780 const char *method_name =
"CrestClient::getPayloadMeta";
782 std::string current_path =
m_PATH;
785 current_path +=
hash;
786 current_path +=
"?format=META";
◆ 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
-
- Returns
- IOV number.
Implements Crest::CrestApiBase.
Definition at line 519 of file CrestApi.cxx.
521 const char *method_name =
"CrestClient::getSize";
523 std::string current_path =
m_PATH;
526 current_path +=
"?tagname=";
535 auto res = respond.find(
"resources");
538 if (
res != respond.end())
540 r = respond[
"resources"][0];
544 if (
r.find(
"niovs") !=
r.end())
550 throw CrestException(
"ERROR in CrestClient::getSize CREST Server JSON response has no \"size\" key.");
◆ 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 319 of file CrestApi.cxx.
321 const char *method_name =
"CrestClient::listGlobalTags";
323 std::string current_path =
m_PATH;
328 current_path +=
"name=";
329 current_path +=
name;
334 current_path +=
"size=";
340 current_path +=
"page=";
346 current_path +=
"sort=";
347 current_path +=
sort;
◆ 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 409 of file CrestApi.cxx.
411 const char *method_name =
"CrestClient::listTags";
413 std::string current_path =
m_PATH;
418 current_path +=
"name=";
419 current_path +=
name;
424 current_path +=
"size=";
430 current_path +=
"page=";
436 current_path +=
"sort=";
437 current_path +=
sort;
◆ makeUrl()
std::string Crest::CrestClient::makeUrl |
( |
const std::string & |
address | ) |
const |
|
private |
◆ 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.
125 std::string plainString =
"";
128 for (
long unsigned int i = 0;
i < xmlBuffer.length();
i++)
130 char convertc = xmlBuffer[
i];
134 else if (convertc ==
'>')
141 plainString += convertc;
◆ 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.
151 std::string str2 =
str;
155 while ((
pos = str2.find(needle)) != str2.npos)
◆ 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
-
Implements Crest::CrestApiBase.
Definition at line 362 of file CrestApi.cxx.
364 const char *method_name =
"CrestClient::removeGlobalTag";
366 std::string current_path =
m_PATH;
370 current_path +=
name;
◆ 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 598 of file CrestApi.cxx.
600 const char *method_name =
"CrestClient::removeGlobalTagMap";
602 std::string current_path =
m_PATH;
605 current_path +=
name;
609 current_path +=
"tagname=";
615 current_path +=
"record=";
616 current_path += record;
621 current_path +=
"label=";
622 current_path +=
label;
◆ 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
-
Implements Crest::CrestApiBase.
Definition at line 452 of file CrestApi.cxx.
454 const char *method_name =
"CrestClient::removeTag";
456 std::string current_path =
m_PATH;
460 current_path +=
name;
◆ 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 678 of file CrestApi.cxx.
680 const char *method_name =
"CrestClient::selectGroups";
682 std::string current_path =
m_PATH;
685 current_path +=
"?method=";
687 current_path +=
"&tagname=";
689 current_path +=
name;
690 current_path +=
"&snapshot=";
694 current_path +=
"&size=";
696 current_path +=
"&page=";
698 current_path +=
"&sort=";
699 current_path +=
sort;
◆ 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 633 of file CrestApi.cxx.
635 const char *method_name =
"CrestClient::selectIovs";
637 std::string current_path =
m_PATH;
640 current_path +=
"?method=";
642 current_path +=
"&tagname=";
644 current_path +=
name;
645 current_path +=
"&since=";
647 current_path +=
"&until=";
650 current_path +=
"INF";
656 current_path +=
"&snapshot=";
659 current_path +=
"&size=";
661 current_path +=
"&page=";
663 current_path +=
"&sort=";
664 current_path +=
sort;
◆ 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 715 of file CrestApi.cxx.
724 std::string current_path =
m_PATH;
726 std::vector<std::string>
files;
729 if (payloadFormat ==
"JSON")
738 auto subjectIdIter1 = js.find(
"resources");
739 if (subjectIdIter1 != js.end())
741 resources = js[
"resources"];
743 int partN = resources.size();
744 for (
int i = 0;
i < partN;
i++)
747 std::string file_param;
749 auto subjectIdIter1 = element.find(
"data");
750 if (subjectIdIter1 != element.end())
752 file_param = element[
"data"];
755 int found_dots = file_param.find_first_of(
':');
756 int word_size = file_param.size();
757 std::string data_file = file_param.substr(found_dots + 3, word_size);
758 files.push_back(data_file);
◆ updateTagMeta()
void Crest::CrestClient::updateTagMeta |
( |
TagMetaDto & |
tag | ) |
|
|
overridevirtual |
This method updates a tag meta info on the CREST server.
- Parameters
-
Implements Crest::CrestApiBase.
Definition at line 483 of file CrestApi.cxx.
485 const char *method_name =
"CrestClient::updateTagMeta";
487 std::string current_path =
m_PATH;
490 current_path += dto.tagName;
◆ m_host
std::string Crest::CrestClient::m_host |
|
private |
◆ m_PATH
◆ m_port
std::string Crest::CrestClient::m_port |
|
private |
◆ m_prefix
std::string Crest::CrestClient::m_prefix = "http://" |
|
private |
◆ m_request
◆ s_ADMIN_PATH
const std::string Crest::CrestClient::s_ADMIN_PATH = "/admin" |
|
inlinestaticprivate |
◆ s_CREST_CLIENT_CHECK
const bool Crest::CrestClient::s_CREST_CLIENT_CHECK = false |
|
inlinestatic |
◆ s_CREST_CLIENT_VERSION
const std::string Crest::CrestClient::s_CREST_CLIENT_VERSION = "5.0" |
|
inlinestaticprivate |
◆ s_DATA_PATH
const std::string Crest::CrestClient::s_DATA_PATH = "/data" |
|
inlinestaticprivate |
◆ s_FOLDER_PATH
const std::string Crest::CrestClient::s_FOLDER_PATH = "/folders" |
|
inlinestaticprivate |
◆ s_GLOBALTAG_MAP_PATH
const std::string Crest::CrestClient::s_GLOBALTAG_MAP_PATH = "/globaltagmaps" |
|
inlinestaticprivate |
◆ s_GLOBALTAG_PATH
const std::string Crest::CrestClient::s_GLOBALTAG_PATH = "/globaltags" |
|
inlinestaticprivate |
◆ s_IOV_PATH
const std::string Crest::CrestClient::s_IOV_PATH = "/iovs" |
|
inlinestaticprivate |
◆ s_IOV_SIZE_PATH
const std::string Crest::CrestClient::s_IOV_SIZE_PATH = "/size" |
|
inlinestaticprivate |
◆ s_META_PATH
const std::string Crest::CrestClient::s_META_PATH = "/meta" |
|
inlinestaticprivate |
◆ s_METHOD_GROUPS
const std::string Crest::CrestClient::s_METHOD_GROUPS = "GROUPS" |
|
inlinestaticprivate |
◆ s_METHOD_IOVS
const std::string Crest::CrestClient::s_METHOD_IOVS = "IOVS" |
|
inlinestaticprivate |
◆ s_MGMT_INFO_PATH
const std::string Crest::CrestClient::s_MGMT_INFO_PATH = "/info" |
|
inlinestaticprivate |
◆ s_MGMT_INFO_PATH_2
const std::string Crest::CrestClient::s_MGMT_INFO_PATH_2 = "/actuator/info" |
|
inlinestaticprivate |
◆ s_MGMT_PATH
const std::string Crest::CrestClient::s_MGMT_PATH = "/mgmt" |
|
inlinestaticprivate |
◆ s_MONITORING_PAYLOAD_PATH
const std::string Crest::CrestClient::s_MONITORING_PAYLOAD_PATH = "/monitoring/payloads" |
|
inlinestaticprivate |
◆ s_PAYLOAD_PATH
const std::string Crest::CrestClient::s_PAYLOAD_PATH = "/payloads" |
|
inlinestaticprivate |
◆ s_RUNINFO_LIST_PATH
const std::string Crest::CrestClient::s_RUNINFO_LIST_PATH = "/list" |
|
inlinestaticprivate |
◆ s_RUNINFO_PATH
const std::string Crest::CrestClient::s_RUNINFO_PATH = "/runinfo" |
|
inlinestaticprivate |
◆ s_TAG_PATH
const std::string Crest::CrestClient::s_TAG_PATH = "/tags" |
|
inlinestaticprivate |
The documentation for this class was generated from the following files:
static GlobalTagMapSetDto from_json(const json &j)
static const std::string s_TAG_PATH
std::string replace(std::string s, const std::string &s2, const std::string &s3)
nlohmann::json getJson(const std::string &str, const char *method) const
Auxiliary method to convert string in to JSON object.
static const std::string s_MGMT_INFO_PATH
static const std::string s_ADMIN_PATH
std::vector< PayloadDto > resources
static const std::string s_IOV_PATH
static const std::string s_METHOD_IOVS
std::string performRequest(const std::string ¤t_path, Action action, nlohmann::json &js, const std::string &header_params="")
General auxiliary method to make request to the CREST Server.
static const std::string s_GLOBALTAG_MAP_PATH
std::string uploadPayload(const std::string ¤t_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)
void setPrefix(const std::string &prefix)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
void setHost(const std::string &host)
static const std::string s_GLOBALTAG_PATH
static const std::string s_META_PATH
static const std::string s_METHOD_GROUPS
std::string getCrestVersion()
This method returns the full CREST Server version.
static const std::string s_MGMT_PATH
std::pair< std::vector< unsigned int >, bool > res
static PayloadSetDto from_json(const json &j)
static const std::string s_CREST_CLIENT_VERSION
std::string getClientVersion()
This method returns the full CrestApi version.
static const std::string s_PAYLOAD_PATH
std::string to_string(const DetectorType &type)
void checkCrestVersion()
This method is a CREST version test.
nlohmann::json getMgmtInfo()
This is an auxiliary method to read the CREST Server properties.
static IovSetDto from_json(const json &j)
Crest::CrestRequest m_request
std::string parseXMLOutput(const std::string_view xmlBuffer) const
This method removes all XML/HTML tags from a string.
int getMajorVersion(std::string &str)
This is an auxiliary method to extract a major version number from full version string.
std::string removeCR(const std::string &str) const
This method removes all end of line and carriage return symbols from a string.
void setPort(const std::string &port)
static const std::string s_IOV_SIZE_PATH