3#include <launchdarkly/data_model/descriptors.hpp>
5#include <tl/expected.hpp>
9#include <unordered_map>
11namespace launchdarkly::server_side::data_interfaces {
23 using Error = std::string;
26 using Single = std::optional<data_model::ItemDescriptor<T>>;
29 using SingleResult = tl::expected<Single<T>, Error>;
33 std::unordered_map<std::string, data_model::ItemDescriptor<T>>;
36 using CollectionResult = tl::expected<Collection<T>, Error>;
44 [[nodiscard]]
virtual SingleResult<data_model::Flag>
GetFlag(
45 std::string
const& key)
const = 0;
53 [[nodiscard]]
virtual SingleResult<data_model::Segment>
GetSegment(
54 std::string
const& key)
const = 0;
61 [[nodiscard]]
virtual CollectionResult<data_model::Flag>
AllFlags()
69 [[nodiscard]]
virtual CollectionResult<data_model::Segment>
AllSegments()
75 [[nodiscard]]
virtual std::string
const&
Identity()
const = 0;
IDataReader obtains data on-demand. Calls to obtain data may fail, so the getter methods use tl::expe...
Definition idata_reader.hpp:21
virtual CollectionResult< data_model::Segment > AllSegments() const =0
Attempts to get a collection of all segments.
virtual CollectionResult< data_model::Flag > AllFlags() const =0
Attempts to get a collection of all flags.
virtual std::string const & Identity() const =0
virtual bool Initialized() const =0
virtual SingleResult< data_model::Segment > GetSegment(std::string const &key) const =0
Attempts to get a segment named by key.
virtual SingleResult< data_model::Flag > GetFlag(std::string const &key) const =0
Attempts to get a flag named by key.