|
C++ Client-Side SDK
LaunchDarkly SDK
|
#include <flag_persistence.hpp>


Public Types | |
| using | TimeStampsource = std::function< std::chrono::time_point< std::chrono::system_clock >()> |
Public Member Functions | |
| FlagPersistence (std::string const &sdk_key, IDataSourceUpdateSink &sink, FlagStore &flag_store, std::shared_ptr< IPersistence > persistence, Logger &logger, std::size_t max_cached_contexts, TimeStampsource time_stamper=[]() { return std::chrono::system_clock::now();}) | |
| void | Init (Context const &context, std::unordered_map< std::string, ItemDescriptor > data) override |
| void | Upsert (Context const &context, std::string key, ItemDescriptor item) override |
| void | Apply (Context const &context, FlagChangeSet change_set, bool from_cache) override |
| void | LoadCached (Context const &context) |
| std::optional< std::unordered_map< std::string, ItemDescriptor > > | ReadCached (Context const &context) |
| std::optional< std::chrono::time_point< std::chrono::system_clock > > | ReadFreshness (Context const &context) |
Public Member Functions inherited from launchdarkly::client_side::IDataSourceUpdateSink | |
| IDataSourceUpdateSink (IDataSourceUpdateSink const &item)=delete | |
| IDataSourceUpdateSink (IDataSourceUpdateSink &&item)=delete | |
| IDataSourceUpdateSink & | operator= (IDataSourceUpdateSink const &)=delete |
| IDataSourceUpdateSink & | operator= (IDataSourceUpdateSink &&)=delete |
Mirrors data source updates into the persistent store on their way to the next sink, and reads them back when a context is loaded.
Thread-safe: concurrent reads and updates are serialized.
|
overridevirtual |
Applies a changeset as a single unit. Unlike Upsert, this path does not order or reject updates by version. FDv2 reserves the per-flag version for event tracking and manages payload consistency through selectors instead.
| from_cache | Whether the changeset was loaded from the local cache. Such data is not written back, nor treated as current. |
Implements launchdarkly::client_side::IDataSourceUpdateSink.
| std::optional< std::unordered_map< std::string, ItemDescriptor > > launchdarkly::client_side::flag_manager::FlagPersistence::ReadCached | ( | Context const & | context | ) |
Returns the flag data stored for the given context, or nullopt when nothing is stored for it or persistence is disabled. An empty map means an environment with no flags was stored, which is distinct from nothing being stored at all.
| std::optional< std::chrono::time_point< std::chrono::system_clock > > launchdarkly::client_side::flag_manager::FlagPersistence::ReadFreshness | ( | Context const & | context | ) |
Returns the time the service last confirmed the flag data for this context was current. Returns nullopt if the service never confirmed it, or if no flag data is cached for the context now.
Keyed by the context's whole set of attributes, not just its key, because changing an attribute can change how flags evaluate.