3 #include "../../data_interfaces/destination/itransactional_destination.hpp"
4 #include "../../data_interfaces/item_change.hpp"
5 #include "../../data_interfaces/store/istore.hpp"
7 #include <launchdarkly/data_model/change_set.hpp>
12 #include <unordered_map>
14 namespace launchdarkly::server_side::data_components {
19 [[nodiscard]] std::shared_ptr<data_model::FlagDescriptor>
GetFlag(
20 std::string
const& key)
const override;
22 [[nodiscard]] std::shared_ptr<data_model::SegmentDescriptor>
GetSegment(
23 std::string
const& key)
const override;
26 unordered_map<std::string, std::shared_ptr<data_model::FlagDescriptor>>
29 [[nodiscard]] std::unordered_map<
31 std::shared_ptr<data_model::SegmentDescriptor>>
36 [[nodiscard]] std::string
const&
Identity()
const override;
38 void Init(data_model::SDKDataSet dataSet)
override;
40 void Upsert(std::string
const& key,
41 data_model::FlagDescriptor flag)
override;
43 void Upsert(std::string
const& key,
44 data_model::SegmentDescriptor segment)
override;
46 bool RemoveFlag(std::string
const& key);
48 bool RemoveSegment(std::string
const& key);
50 void Apply(data_model::ChangeSet<data_interfaces::ChangeSetData> changeSet)
62 static inline std::string
const description_ =
"memory";
63 std::unordered_map<std::string, std::shared_ptr<data_model::FlagDescriptor>>
65 std::unordered_map<std::string,
66 std::shared_ptr<data_model::SegmentDescriptor>>
68 bool initialized_ =
false;
69 mutable std::mutex data_mutex_;
Definition: memory_store.hpp:17
std::unordered_map< std::string, std::shared_ptr< data_model::SegmentDescriptor > > AllSegments() const override
Get a map of all segments.
Definition: memory_store.cpp:34
void Init(data_model::SDKDataSet dataSet) override
Initialize the destination with a base set of data.
Definition: memory_store.cpp:48
std::unordered_map< std::string, std::shared_ptr< data_model::FlagDescriptor > > AllFlags() const override
Get a map of all flags.
Definition: memory_store.cpp:28
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:17
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:7
std::string const & Identity() const override
Definition: memory_store.cpp:44
void Upsert(std::string const &key, data_model::FlagDescriptor flag) override
Upsert a flag named by key.
Definition: memory_store.cpp:64
bool Initialized() const override
Definition: memory_store.cpp:39
IStore provides shared ownership of flag and segment domain objects.
Definition: istore.hpp:15
Definition: itransactional_destination.hpp:18