-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathdelta_sharing_rest_client.hpp
More file actions
53 lines (45 loc) · 1.98 KB
/
delta_sharing_rest_client.hpp
File metadata and controls
53 lines (45 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* Node type: Delta Sharing.
*
* Author: Ritesh Karki <ritesh.karki@rwth-aachen.de>
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <iostream>
#include <list>
#include <nlohmann/json.hpp>
#include <restclient-cpp/connection.h>
#include <restclient-cpp/restclient.h>
#include <villas/nodes/delta_sharing/protocol.hpp>
using json = nlohmann::json;
namespace DeltaSharing {
struct DeltaSharingRestClient {
public:
DeltaSharingRestClient(const std::string &filename);
~DeltaSharingRestClient();
const std::shared_ptr<std::vector<DeltaSharingProtocol::Share>>
ListShares(int maxResult, const std::string &pageToken) const;
const std::shared_ptr<std::vector<DeltaSharingProtocol::Schema>>
ListSchemas(const DeltaSharingProtocol::Share &share, int maxResult,
const std::string &pageToken) const;
const std::shared_ptr<std::vector<DeltaSharingProtocol::Table>>
ListTables(const DeltaSharingProtocol::Schema &schema, int maxResult,
const std::string &pageToken) const;
const std::shared_ptr<std::vector<DeltaSharingProtocol::Table>>
ListAllTables(const DeltaSharingProtocol::Share &share, int maxResult,
const std::string &pageToken) const;
const std::shared_ptr<std::vector<DeltaSharingProtocol::File>>
ListFilesInTable(const DeltaSharingProtocol::Table &) const;
const DeltaSharingProtocol::Metadata
QueryTableMetadata(const DeltaSharingProtocol::Table &table) const;
const DeltaSharingProtocol::DeltaSharingProfile &GetProfile() const;
RestClient::Response get(std::string url);
void PopulateCache(const std::string &url, const std::string &cacheLocation);
const bool shouldRetry(RestClient::Response &response) const;
protected:
json ReadFromFile(const std::string &filename);
private:
DeltaSharingProtocol::DeltaSharingProfile profile;
static const std::string user_agent;
};
}; // namespace DeltaSharing