C++ Server-Side SDK
LaunchDarkly SDK
Loading...
Searching...
No Matches
ibootstrapper.hpp
1#pragma once
2
3#include <launchdarkly/data_model/sdk_data_set.hpp>
4
5#include <tl/expected.hpp>
6
7#include <functional>
8#include <memory>
9#include <string>
10#include <unordered_map>
11
12namespace launchdarkly::server_side::data_interfaces {
13
21 public:
22 class Error {
23 public:
24 enum class Kind {
25 None,
26 Timeout,
27 Auth,
28 };
29
30 static Error Timeout(std::string detail) {
31 return Error(Kind::Timeout, std::move(detail));
32 }
33
34 static Error Auth(std::string detail) {
35 return Error(Kind::Auth, std::move(detail));
36 }
37
38 Error() : kind(Kind::None), detail(std::nullopt) {}
39
40 private:
41 Error(Kind kind, std::optional<std::string> detail)
42 : kind(kind), detail(std::move(detail)) {}
43 Kind kind;
44 std::optional<std::string> detail;
45 };
46
54 virtual tl::expected<data_model::SDKDataSet, Error> FetchAll(
55 std::chrono::milliseconds timeout_hint) = 0;
56
60 virtual std::string const& Identity() const = 0;
61
62 virtual ~IBootstrapper() = default;
63 IBootstrapper(IBootstrapper const& item) = delete;
64 IBootstrapper(IBootstrapper&& item) = delete;
65 IBootstrapper& operator=(IBootstrapper const&) = delete;
66 IBootstrapper& operator=(IBootstrapper&&) = delete;
67
68 protected:
69 IBootstrapper() = default;
70};
71
72} // namespace launchdarkly::server_side::data_interfaces
virtual tl::expected< data_model::SDKDataSet, Error > FetchAll(std::chrono::milliseconds timeout_hint)=0
virtual std::string const & Identity() const =0