C++ Server-Side SDK
LaunchDarkly SDK
Classes | Public Types | Public Member Functions | List of all members
launchdarkly::server_side::integrations::ISerializedDataReader Class Referenceabstract

#include <iserialized_data_reader.hpp>

Classes

struct  Error
 

Public Types

using GetResult = tl::expected< std::optional< SerializedItemDescriptor >, Error >
 
using AllResult = tl::expected< std::unordered_map< std::string, SerializedItemDescriptor >, Error >
 

Public Member Functions

 ISerializedDataReader (ISerializedDataReader const &item)=delete
 
 ISerializedDataReader (ISerializedDataReader &&item)=delete
 
ISerializedDataReaderoperator= (ISerializedDataReader const &)=delete
 
ISerializedDataReaderoperator= (ISerializedDataReader &&)=delete
 
virtual GetResult Get (ISerializedItemKind const &kind, std::string const &itemKey) const =0
 
virtual AllResult All (ISerializedItemKind const &kind) const =0
 
virtual std::string const & Identity () const =0
 
virtual bool Initialized () const =0
 

Detailed Description

Interface for a data reader that provides feature flags and related data in a serialized form.

This interface should be used for database integrations, or any other data source implementation that retrieves data from some external service.

The SDK will take care of converting between its own internal data model and a serialized string form; the source interacts only with the serialized form.

The SDK will also provide its own caching layer in front of this source; this source should not provide caching, but simply do every query or update that the SDK tells it to do.

Implementations must be thread-safe.

Member Function Documentation

◆ All()

virtual AllResult launchdarkly::server_side::integrations::ISerializedDataReader::All ( ISerializedItemKind const &  kind) const
pure virtual

Retrieves all items from the specified collection.

If the store contains placeholders for deleted items, it should include them in the results, not filter them out.

Parameters
kindThe kind of data to get.
Returns
Either all of the items of the type, or an error. If there are no items of the specified type, then return an empty collection.

◆ Get()

virtual GetResult launchdarkly::server_side::integrations::ISerializedDataReader::Get ( ISerializedItemKind const &  kind,
std::string const &  itemKey 
) const
pure virtual

Retrieves an item from the specified collection, if available.

Parameters
kindThe kind of the item.
itemKeyThe key for the item.
Returns
A serialized item descriptor if the item existed, a std::nullopt if the item did not exist, or an error. For a deleted item the serialized item descriptor may contain a std::nullopt for the serializedItem.

◆ Identity()

virtual std::string const& launchdarkly::server_side::integrations::ISerializedDataReader::Identity ( ) const
pure virtual
Returns
Identity of the reader. Used in logs.

◆ Initialized()

virtual bool launchdarkly::server_side::integrations::ISerializedDataReader::Initialized ( ) const
pure virtual
Returns
True if the reader has data that can be queried. The reader should derive this state externally; that is, it should be an attribute of the underlying source of data (not in memory.) A possible implementation would be to store a special data key that is only set after initial SDK data is stored.

The documentation for this class was generated from the following file: