C++ Server-Side SDK
LaunchDarkly SDK
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
launchdarkly::server_side::data_systems::LazyLoad Class Referencefinal

#include <lazy_load_system.hpp>

Inheritance diagram for launchdarkly::server_side::data_systems::LazyLoad:
Inheritance graph
[legend]
Collaboration diagram for launchdarkly::server_side::data_systems::LazyLoad:
Collaboration graph
[legend]

Classes

struct  Kinds
 

Public Types

using ClockType = std::chrono::steady_clock
 
using TimeFn = std::function< std::chrono::time_point< ClockType >()>
 

Public Member Functions

 LazyLoad (Logger const &logger, config::built::LazyLoadConfig cfg, data_components::DataSourceStatusManager &status_manager)
 
 LazyLoad (Logger const &logger, config::built::LazyLoadConfig cfg, data_components::DataSourceStatusManager &status_manager, TimeFn time)
 
std::string const & Identity () const override
 
std::shared_ptr< data_model::FlagDescriptor > GetFlag (std::string const &key) const override
 Get the flag named by key. Returns nullptr if no such flag exists.
 
std::shared_ptr< data_model::SegmentDescriptor > GetSegment (std::string const &key) const override
 Get the segment named by key. Returns nullptr if no such flag exists.
 
std::unordered_map< std::string, std::shared_ptr< data_model::FlagDescriptor > > AllFlags () const override
 Get a map of all flags.
 
std::unordered_map< std::string, std::shared_ptr< data_model::SegmentDescriptor > > AllSegments () const override
 Get a map of all segments.
 
void Initialize () override
 Initializes the system. This method will be called before any of the IStore methods are called.
 
bool Initialized () const override
 
- Public Member Functions inherited from launchdarkly::server_side::data_interfaces::IDataSystem
 IDataSystem (IDataSystem const &item)=delete
 
 IDataSystem (IDataSystem &&item)=delete
 
IDataSystemoperator= (IDataSystem const &)=delete
 
IDataSystemoperator= (IDataSystem &&)=delete
 
- Public Member Functions inherited from launchdarkly::server_side::data_interfaces::IStore
 IStore (IStore const &item)=delete
 
 IStore (IStore &&item)=delete
 
IStoreoperator= (IStore const &)=delete
 
IStoreoperator= (IStore &&)=delete
 

Detailed Description

LazyLoad implements a Data System that pulls data from a persistent store on-demand. It is intended for use cases where holding an entire environment in memory isn't desired, or for uses that disallow direct communication with LaunchDarkly servers.

LazyLoad is able to remain efficient because it caches responses from the store. Over time, data becomes stale causing the system to refresh data.

Member Function Documentation

◆ AllFlags()

std::unordered_map< std::string, std::shared_ptr< data_model::FlagDescriptor > > launchdarkly::server_side::data_systems::LazyLoad::AllFlags ( ) const
overridevirtual

Get a map of all flags.

Returns
Map of shared pointers to flags.

Implements launchdarkly::server_side::data_interfaces::IStore.

◆ AllSegments()

std::unordered_map< std::string, std::shared_ptr< data_model::SegmentDescriptor > > launchdarkly::server_side::data_systems::LazyLoad::AllSegments ( ) const
overridevirtual

Get a map of all segments.

Returns
Map of shared pointers to segments.

Implements launchdarkly::server_side::data_interfaces::IStore.

◆ GetFlag()

std::shared_ptr< data_model::FlagDescriptor > launchdarkly::server_side::data_systems::LazyLoad::GetFlag ( std::string const &  key) const
overridevirtual

Get the flag named by key. Returns nullptr if no such flag exists.

Parameters
keyKey of the flag.
Returns
Shared pointer to the flag.

Implements launchdarkly::server_side::data_interfaces::IStore.

◆ GetSegment()

std::shared_ptr< data_model::SegmentDescriptor > launchdarkly::server_side::data_systems::LazyLoad::GetSegment ( std::string const &  key) const
overridevirtual

Get the segment named by key. Returns nullptr if no such flag exists.

Parameters
keyKey of the segment.
Returns
Shared pointer to the segment.

Implements launchdarkly::server_side::data_interfaces::IStore.

◆ Identity()

std::string const & launchdarkly::server_side::data_systems::LazyLoad::Identity ( ) const
overridevirtual
Returns
Identity of the system. Used in logs.

Implements launchdarkly::server_side::data_interfaces::IDataSystem.

◆ Initialize()

void launchdarkly::server_side::data_systems::LazyLoad::Initialize ( )
overridevirtual

Initializes the system. This method will be called before any of the IStore methods are called.

Implements launchdarkly::server_side::data_interfaces::IDataSystem.

◆ Initialized()

bool launchdarkly::server_side::data_systems::LazyLoad::Initialized ( ) const
overridevirtual
Returns
True if the store has ever contained data.

Implements launchdarkly::server_side::data_interfaces::IStore.


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