3#include "../../data_interfaces/destination/idestination.hpp"
4#include "../../data_interfaces/store/istore.hpp"
9#include <unordered_map>
11namespace launchdarkly::server_side::data_components {
16 [[nodiscard]] std::shared_ptr<data_model::FlagDescriptor>
GetFlag(
17 std::string
const& key)
const override;
19 [[nodiscard]] std::shared_ptr<data_model::SegmentDescriptor>
GetSegment(
20 std::string
const& key)
const override;
23 unordered_map<std::string, std::shared_ptr<data_model::FlagDescriptor>>
26 [[nodiscard]] std::unordered_map<
28 std::shared_ptr<data_model::SegmentDescriptor>>
33 [[nodiscard]] std::string
const&
Identity()
const override;
35 void Init(data_model::SDKDataSet dataSet)
override;
37 void Upsert(std::string
const& key,
38 data_model::FlagDescriptor flag)
override;
40 void Upsert(std::string
const& key,
41 data_model::SegmentDescriptor segment)
override;
43 bool RemoveFlag(std::string
const& key);
45 bool RemoveSegment(std::string
const& key);
56 static inline std::string
const description_ =
"memory";
57 std::unordered_map<std::string, std::shared_ptr<data_model::FlagDescriptor>>
59 std::unordered_map<std::string,
60 std::shared_ptr<data_model::SegmentDescriptor>>
62 bool initialized_ =
false;
63 mutable std::mutex data_mutex_;
Definition memory_store.hpp:14
std::unordered_map< std::string, std::shared_ptr< data_model::SegmentDescriptor > > AllSegments() const override
Get a map of all segments.
Definition memory_store.cpp:32
void Init(data_model::SDKDataSet dataSet) override
Initialize the destination with a base set of data.
Definition memory_store.cpp:46
std::unordered_map< std::string, std::shared_ptr< data_model::FlagDescriptor > > AllFlags() const override
Get a map of all flags.
Definition memory_store.cpp:26
std::shared_ptr< data_model::SegmentDescriptor > GetSegment(std::string const &key) const override
Get the segment named by key. Returns nullptr if no such flag exists.
Definition memory_store.cpp:15
std::shared_ptr< data_model::FlagDescriptor > GetFlag(std::string const &key) const override
Get the flag named by key. Returns nullptr if no such flag exists.
Definition memory_store.cpp:5
std::string const & Identity() const override
Definition memory_store.cpp:42
void Upsert(std::string const &key, data_model::FlagDescriptor flag) override
Upsert a flag named by key.
Definition memory_store.cpp:62
bool Initialized() const override
Definition memory_store.cpp:37
IDestination represents a sink for data received by the SDK. A destination may be a database,...
Definition idestination.hpp:14
IStore provides shared ownership of flag and segment domain objects.
Definition istore.hpp:15