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

JsonDestination is responsible for converting flag and segment models into serialized data suitable for storage in an ISerializedDestination. More...

#include <json_destination.hpp>

Inheritance diagram for launchdarkly::server_side::data_components::JsonDestination:
Inheritance graph
[legend]
Collaboration diagram for launchdarkly::server_side::data_components::JsonDestination:
Collaboration graph
[legend]

Classes

struct  Kinds
 These are public so they can be referenced in tests. More...
 

Public Member Functions

 JsonDestination (Logger const &logger, data_interfaces::ISerializedDestination &destination)
 Construct the JsonDestination with the given ISerializedDestination. Calls to Upsert will trigger serialization and store to the destination.
 
void Init (data_model::SDKDataSet data_set) override
 Initialize the destination with an SDK data set.
 
void Upsert (std::string const &key, data_model::FlagDescriptor flag) override
 Upsert data for the flag named by key.
 
void Upsert (std::string const &key, data_model::SegmentDescriptor segment) override
 Upsert data for the segment named by key.
 
std::string const & Identity () const override
 
- Public Member Functions inherited from launchdarkly::server_side::data_interfaces::IDestination
 IDestination (IDestination const &item)=delete
 
 IDestination (IDestination &&item)=delete
 
IDestinationoperator= (IDestination const &)=delete
 
IDestinationoperator= (IDestination &&)=delete
 

Detailed Description

JsonDestination is responsible for converting flag and segment models into serialized data suitable for storage in an ISerializedDestination.

By encapsulating the serialization logic here, different adapters can be swapped in if our serialization format ever changes.

JsonDestination does not currently initialize ISerializedDestination with a flag-dependency-order payload, which is required to minimize bugs in stores without atomic transactions (e.g. DynamoDB).

Instead, it sorts items within a collection using 'operator<' on their keys, giving which is enough determinism for testing purposes.

TODO(sc-225327): Implement topographic sort as prerequisite for DynamoDB.

Constructor & Destructor Documentation

◆ JsonDestination()

launchdarkly::server_side::data_components::JsonDestination::JsonDestination ( Logger const &  logger,
data_interfaces::ISerializedDestination destination 
)

Construct the JsonDestination with the given ISerializedDestination. Calls to Upsert will trigger serialization and store to the destination.

Parameters
loggerUsed for logging storage errors.
destinationWhere data should be forwarded.

Member Function Documentation

◆ Identity()

std::string const & launchdarkly::server_side::data_components::JsonDestination::Identity ( ) const
overridevirtual
Returns
Identity of this destination. Used in logs.

Implements launchdarkly::server_side::data_interfaces::IDestination.

◆ Init()

void launchdarkly::server_side::data_components::JsonDestination::Init ( data_model::SDKDataSet  data_set)
overridevirtual

Initialize the destination with an SDK data set.

Parameters
data_setThe initial data.

Implements launchdarkly::server_side::data_interfaces::IDestination.

◆ Upsert() [1/2]

void launchdarkly::server_side::data_components::JsonDestination::Upsert ( std::string const &  key,
data_model::FlagDescriptor  flag 
)
overridevirtual

Upsert data for the flag named by key.

If the descriptor represents a deleted item, a tombstone will be forwarded to the ISerializedDestination.

Parameters
keyKey of flag.
flagDescriptor of flag.

Implements launchdarkly::server_side::data_interfaces::IDestination.

◆ Upsert() [2/2]

void launchdarkly::server_side::data_components::JsonDestination::Upsert ( std::string const &  key,
data_model::SegmentDescriptor  segment 
)
overridevirtual

Upsert data for the segment named by key.

If the descriptor represents a deleted item, a tombstone will be forwarded to the ISerializedDestination.

Parameters
keyKey of segment.
segmentDescriptor of segment.

Implements launchdarkly::server_side::data_interfaces::IDestination.


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