C++ Server-Side SDK
LaunchDarkly SDK
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
launchdarkly::server_side::data_interfaces::IDataReader Class Referenceabstract

IDataReader obtains data on-demand. Calls to obtain data may fail, so the getter methods use tl::expected in order to propagate error codes. More...

#include <idata_reader.hpp>

Inheritance diagram for launchdarkly::server_side::data_interfaces::IDataReader:
Inheritance graph
[legend]

Public Types

using Error = std::string
 
template<typename T >
using Single = std::optional< data_model::ItemDescriptor< T > >
 
template<typename T >
using SingleResult = tl::expected< Single< T >, Error >
 
template<typename T >
using Collection = std::unordered_map< std::string, data_model::ItemDescriptor< T > >
 
template<typename T >
using CollectionResult = tl::expected< Collection< T >, Error >
 

Public Member Functions

virtual SingleResult< data_model::Flag > GetFlag (std::string const &key) const =0
 Attempts to get a flag named by key.
 
virtual SingleResult< data_model::Segment > GetSegment (std::string const &key) const =0
 Attempts to get a segment named by key.
 
virtual CollectionResult< data_model::Flag > AllFlags () const =0
 Attempts to get a collection of all flags.
 
virtual CollectionResult< data_model::Segment > AllSegments () const =0
 Attempts to get a collection of all segments.
 
virtual std::string const & Identity () const =0
 
virtual bool Initialized () const =0
 
 IDataReader (IDataReader const &item)=delete
 
 IDataReader (IDataReader &&item)=delete
 
IDataReaderoperator= (IDataReader const &)=delete
 
IDataReaderoperator= (IDataReader &&)=delete
 

Detailed Description

IDataReader obtains data on-demand. Calls to obtain data may fail, so the getter methods use tl::expected in order to propagate error codes.

The IDataReader does not perform caching, so parent components must be careful to avoid repeatedly fetching data (i.e. use a cache.)

Member Function Documentation

◆ AllFlags()

virtual CollectionResult< data_model::Flag > launchdarkly::server_side::data_interfaces::IDataReader::AllFlags ( ) const
pure virtual

Attempts to get a collection of all flags.

Returns
On success, a collection of FlagDescriptors. On failure, an error string.

Implemented in launchdarkly::server_side::data_components::JsonDeserializer.

◆ AllSegments()

virtual CollectionResult< data_model::Segment > launchdarkly::server_side::data_interfaces::IDataReader::AllSegments ( ) const
pure virtual

Attempts to get a collection of all segments.

Returns
On success, a collection of SegmentDescriptors. On failure, an error string.

Implemented in launchdarkly::server_side::data_components::JsonDeserializer.

◆ GetFlag()

virtual SingleResult< data_model::Flag > launchdarkly::server_side::data_interfaces::IDataReader::GetFlag ( std::string const &  key) const
pure virtual

Attempts to get a flag named by key.

Parameters
keyKey of the flag.
Returns
On success, an optional FlagDescriptor (std::nullopt means the flag doesn't exist.) On failure, an error string.

Implemented in launchdarkly::server_side::data_components::JsonDeserializer.

◆ GetSegment()

virtual SingleResult< data_model::Segment > launchdarkly::server_side::data_interfaces::IDataReader::GetSegment ( std::string const &  key) const
pure virtual

Attempts to get a segment named by key.

Parameters
keyKey of the segment.
Returns
On success, an optional SegmentDescriptor (std::nullopt means the segment doesn't exist.) On failure, an error string.

Implemented in launchdarkly::server_side::data_components::JsonDeserializer.

◆ Identity()

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

Implemented in launchdarkly::server_side::data_components::JsonDeserializer.

◆ Initialized()

virtual bool launchdarkly::server_side::data_interfaces::IDataReader::Initialized ( ) const
pure virtual
Returns
Whether the reader is initialized.

Implemented in launchdarkly::server_side::data_components::JsonDeserializer.


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