23 Gateway(
const std::string& host,
const std::string& port,
24 const std::string& jobname,
const Labels& labels = {},
25 const std::string& username = {},
const std::string& password = {});
34 void RegisterCollectable(
const std::weak_ptr<Collectable>& collectable,
35 const Labels* labels =
nullptr);
37 static Labels GetInstanceLabel(std::string hostname);
42 std::future<int> AsyncPush();
47 std::future<int> AsyncPushAdd();
53 std::future<int> AsyncDelete();
56 int DeleteForInstance();
59 std::future<int> AsyncDeleteForInstance();
64 std::unique_ptr<detail::CurlWrapper> curlWrapper_;
67 using CollectableEntry = std::pair<std::weak_ptr<Collectable>, std::string>;
68 std::vector<CollectableEntry> collectables_;
70 std::string getUri(
const CollectableEntry& collectable)
const;
72 int push(detail::HttpMethod method);
74 std::future<int> async_push(detail::HttpMethod method);
76 static void CleanupStalePointers(std::vector<CollectableEntry>& collectables);