C++ Client-Side SDK
LaunchDarkly SDK
Loading...
Searching...
No Matches
flag_store.hpp
1#pragma once
2
3#include <mutex>
4#include <string>
5#include <unordered_map>
6
7#include "../data_sources/data_source_update_sink.hpp"
8#include "context_index.hpp"
9
10#include <launchdarkly/persistence/persistence.hpp>
11
12namespace launchdarkly::client_side::flag_manager {
13
14class FlagStore {
15 public:
16 void Init(std::unordered_map<std::string, ItemDescriptor> const& data);
17 void Upsert(std::string const& key, ItemDescriptor item);
18
26 std::shared_ptr<ItemDescriptor> Get(std::string const& flag_key) const;
27
33 std::unordered_map<std::string, std::shared_ptr<ItemDescriptor>> GetAll()
34 const;
35
36 private:
37 void UpdateData(
38 std::unordered_map<std::string, ItemDescriptor> const& data);
39
40 std::unordered_map<std::string, std::shared_ptr<ItemDescriptor>> data_;
41 mutable std::mutex data_mutex_;
42};
43
44} // namespace launchdarkly::client_side::flag_manager
std::shared_ptr< ItemDescriptor > Get(std::string const &flag_key) const
Definition flag_store.cpp:33
std::unordered_map< std::string, std::shared_ptr< ItemDescriptor > > GetAll() const
Definition flag_store.cpp:45