C++ Server-Side SDK
LaunchDarkly SDK
|
JsonDestination is responsible for converting flag and segment models into serialized data suitable for storage in an ISerializedDestination. More...
#include <json_destination.hpp>
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 |
![]() | |
IDestination (IDestination const &item)=delete | |
IDestination (IDestination &&item)=delete | |
IDestination & | operator= (IDestination const &)=delete |
IDestination & | operator= (IDestination &&)=delete |
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.
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.
logger | Used for logging storage errors. |
destination | Where data should be forwarded. |
|
overridevirtual |
Implements launchdarkly::server_side::data_interfaces::IDestination.
|
overridevirtual |
Initialize the destination with an SDK data set.
data_set | The initial data. |
Implements launchdarkly::server_side::data_interfaces::IDestination.
|
overridevirtual |
Upsert data for the flag named by key.
If the descriptor represents a deleted item, a tombstone will be forwarded to the ISerializedDestination.
key | Key of flag. |
flag | Descriptor of flag. |
Implements launchdarkly::server_side::data_interfaces::IDestination.
|
overridevirtual |
Upsert data for the segment named by key.
If the descriptor represents a deleted item, a tombstone will be forwarded to the ISerializedDestination.
key | Key of segment. |
segment | Descriptor of segment. |
Implements launchdarkly::server_side::data_interfaces::IDestination.