7 #include "../data_sources/data_source_update_sink.hpp"
8 #include "context_index.hpp"
9 #include "flag_store.hpp"
11 #include <launchdarkly/context.hpp>
12 #include <launchdarkly/logging/logger.hpp>
13 #include <launchdarkly/persistence/persistence.hpp>
15 namespace launchdarkly::client_side::flag_manager {
17 std::string PersistenceEncodeKey(std::string
const& input);
21 using TimeStampsource =
22 std::function<std::chrono::time_point<std::chrono::system_clock>()>;
25 std::string
const& sdk_key,
28 std::shared_ptr<IPersistence> persistence,
30 std::size_t max_cached_contexts,
31 TimeStampsource time_stamper = []() {
32 return std::chrono::system_clock::now();
35 void Init(
Context const& context,
36 std::unordered_map<std::string, ItemDescriptor> data)
override;
38 void Upsert(
Context const& context,
40 ItemDescriptor item)
override;
42 void LoadCached(
Context const& context);
45 inline static std::string global_namespace_ =
"LaunchDarkly";
46 inline static std::string index_key_ =
"ContextIndex";
49 std::size_t max_cached_contexts_;
52 std::shared_ptr<IPersistence> persistence_;
53 mutable std::recursive_mutex persistence_mutex_;
56 std::string environment_namespace_;
57 TimeStampsource time_stamper_;
60 void StoreCache(std::string
const& context_id);
Definition: context.hpp:29
Definition: data_source_update_sink.hpp:21
Definition: context_index.hpp:24
Definition: flag_persistence.hpp:19
Definition: flag_store.hpp:14