ATLAS Offline Software
|
#include <CrestApiExt.h>
Public Member Functions | |
CrestClientExt (const std::string &_host, const std::string &_port, bool _check_version=s_CREST_CLIENT_CHECK) | |
CrestClientExt (const std::string &url, bool check_version=s_CREST_CLIENT_CHECK) | |
BOOST_PARAMETER_MEMBER_FUNCTION ((GlobalTagSetDto), listGlobalTagsParams, tag,(required)(optional(name,(std::string), "")(size,(int), 1000)(page,(int), 0)(sort,(std::string), "name:ASC"))) | |
This method returns the global tag list. More... | |
BOOST_PARAMETER_MEMBER_FUNCTION ((TagSetDto), listTagsParams, tag,(required)(optional(name,(std::string), "")(size,(int), 1000)(page,(int), 0)(sort,(std::string), "name:ASC"))) | |
This method returns the tag list. 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" |
Definition at line 28 of file CrestApiExt.h.
|
inline |
Definition at line 30 of file CrestApiExt.h.
|
inline |
Definition at line 31 of file CrestApiExt.h.
|
inline |
This method returns the global tag list.
It has boost parameters, all of them are optional.
_name | - global tag name pattern, optional parameter, |
_size | - page size, a number of tags per a page, optional parameter, default value is 1000, |
_page | - page number optional parameter, default value is 0, |
_sort | - sorting order, default value is "name:ASC". If you dont use the optional parameter names, you have to use the same parameter order. Example: nlohmann::json list1 = myCrestClient.listGlobalTagsParams(); nlohmann::json list2 = myCrestClient.listGlobalTagsParams("",3,5); nlohmann::json list2 = myCrestClient.listGlobalTagsParams(_page=3,_size=5); |
nlohmann::json listGlobalTagsParams(std::string _name, int _size, int _page);
Definition at line 51 of file CrestApiExt.h.
|
inline |
This method returns the tag list.
It has boost parameters, all of them are optional. (This method is an analogue of the list_tags method in Python)
_name | - tag name pattern, optional parameter, |
_size | - page size, a number of tags per a page, optional parameter, default value is 1000, |
_page | - page number optional parameter, default value is 0, |
_sort | - sorting order, default value is "name:ASC". If you dont use the optional parameter names, you have to use the same parameter order. Example: nlohmann::json list1 = myCrestClient.listTagsParams(); nlohmann::json list2 = myCrestClient.listTagsParams("",3,5); nlohmann::json list2 = myCrestClient.listTagsParams(_page=3,_size=5); |
nlohmann::json listTagsParams(std::string _name, int _size, int _page);
Definition at line 84 of file CrestApiExt.h.
|
inherited |
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.
std::runtime_error | - error, if the versions are different. |
Definition at line 259 of file CrestApi.cxx.
|
privateinherited |
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.)
hash | - the hash from an IOV. |
str | - the payload in std::string. |
Definition at line 795 of file CrestApi.cxx.
|
overridevirtualinherited |
This method creates a global tag on CREST server.
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.
|
overridevirtualinherited |
This method creates a global tag map on the CREST server.
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.
|
overridevirtualinherited |
This method creates a tag on the CREST server.
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.
|
overridevirtualinherited |
This method creates a tag meta info on the CREST server.
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.
|
overridevirtualinherited |
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)
name | - global tag name, |
Implements Crest::CrestApiBase.
Definition at line 295 of file CrestApi.cxx.
|
overridevirtualinherited |
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)
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. |
Implements Crest::CrestApiBase.
Definition at line 565 of file CrestApi.cxx.
This method finds a tag by the name on the CREST server.
(This method is an analogue of the find_tag method in Python)
name | - tag name |
Implements Crest::CrestApiBase.
Definition at line 386 of file CrestApi.cxx.
|
overridevirtualinherited |
This method reads a tag meta info by the tag name from the CREST server.
name | - tag name |
Implements Crest::CrestApiBase.
Definition at line 494 of file CrestApi.cxx.
|
protectedinherited |
This method returns the full CrestApi version.
Definition at line 38 of file CrestApiBase.cxx.
|
overrideprivatevirtualinherited |
This method returns the full CREST Server version.
Implements Crest::CrestApiBase.
Definition at line 214 of file CrestApi.cxx.
|
protectedinherited |
This method method calculates the hash for string.
str | - string. |
Definition at line 32 of file CrestApiBase.cxx.
|
protectedinherited |
This method method calculates the hash for a file.
file | - path to the file with the file name.. |
Definition at line 8 of file CrestApiBase.cxx.
|
privateinherited |
Auxiliary method to convert string in to JSON object.
CrestClient::getJson method is used to convert the string to the json object.
str | - string (std::string) |
method | - method name, which calls this method. This parameter is used to throw an error exception. |
str | - string to be converted to the json object. |
method | - name of the method which calls this method. |
Definition at line 169 of file CrestApi.cxx.
|
privateinherited |
This is an auxiliary method to extract a major version number from full version string.
Definition at line 235 of file CrestApi.cxx.
|
privateinherited |
This is an auxiliary method to read the 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.
|
overridevirtualinherited |
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)
hash | - hash. |
Implements Crest::CrestApiBase.
Definition at line 760 of file CrestApi.cxx.
|
overridevirtualinherited |
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)
hash | - hash. |
Implements Crest::CrestApiBase.
Definition at line 775 of file CrestApi.cxx.
|
overridevirtualinherited |
This method gets the number of IOVs for the given tag.
(This method is an analogue of the get_size method in Python)
tagname | - tag name. |
Implements Crest::CrestApiBase.
Definition at line 515 of file CrestApi.cxx.
|
overridevirtualinherited |
This method finds the global tags on the CREST server.
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), |
Implements Crest::CrestApiBase.
Definition at line 315 of file CrestApi.cxx.
|
overridevirtualinherited |
This method returns the tag list as TagSetDto from the CREST server.
(This method is an analogue of the list_tags method in Python)
name | - tag name pattern, |
size | - page size, |
page | - page number, |
sort | - sorting order (name:ASC or name:DESC). |
Implements Crest::CrestApiBase.
Definition at line 405 of file CrestApi.cxx.
|
privateinherited |
|
privateinherited |
This method removes all XML/HTML tags from a string.
(It is an auxiliary method to clear the CREST Server response.)
xmlBuffer | - the text (a std::string ) to be cleared. |
Definition at line 121 of file CrestApi.cxx.
|
privateinherited |
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.)
str | - the text (a std::string ) to be cleared. |
Definition at line 149 of file CrestApi.cxx.
|
overridevirtualinherited |
This method removes a global tag on the CREST server.
(This method is an analogue of the remove_global_tag method in Python)
name | - global tag name |
Implements Crest::CrestApiBase.
Definition at line 358 of file CrestApi.cxx.
|
overridevirtualinherited |
This method removes a global tag map on the CREST server.
name | - the global tag name, |
label | - label, |
tagname | - tag name. |
Implements Crest::CrestApiBase.
Definition at line 594 of file CrestApi.cxx.
|
overridevirtualinherited |
This method removes a tag from the CREST server.
(This method is an analogue of the remove_tag method in Python)
tagName | - tag name |
Implements Crest::CrestApiBase.
Definition at line 448 of file CrestApi.cxx.
|
overridevirtualinherited |
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)
name | - tag name, |
snapshot | - snapshot, |
size | - page size, |
page | - page number, |
sort | - sorting order (id.since:ASC or id.since:DESC) |
Implements Crest::CrestApiBase.
Definition at line 674 of file CrestApi.cxx.
|
overridevirtualinherited |
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)
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) |
Implements Crest::CrestApiBase.
Definition at line 629 of file CrestApi.cxx.
|
overridevirtualinherited |
This method stores several payloads in batch mode on the CREST server.
(This method is an analogue of the store_data method in Python)
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.
|
overridevirtualinherited |
This method updates a tag meta info on the CREST server.
tag | - tag meta info as TagMetaDto. |
Implements Crest::CrestApiBase.
Definition at line 479 of file CrestApi.cxx.
|
privateinherited |
Definition at line 67 of file CrestApi.h.
|
privateinherited |
Definition at line 37 of file CrestApi.h.
|
privateinherited |
Definition at line 68 of file CrestApi.h.
|
privateinherited |
Definition at line 69 of file CrestApi.h.
|
privateinherited |
Definition at line 71 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 40 of file CrestApi.h.
|
inlinestaticinherited |
Definition at line 168 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 62 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 50 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 52 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 46 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 45 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 41 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 43 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 49 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 57 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 56 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 61 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 63 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 60 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 48 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 47 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 54 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 53 of file CrestApi.h.
|
inlinestaticprivateinherited |
Definition at line 39 of file CrestApi.h.