C++ Server-Side SDK
LaunchDarkly SDK
|
Public Types | |
using | FlagKey = std::string |
Public Types inherited from launchdarkly::server_side::IClient | |
using | FlagKey = std::string |
Public Member Functions | |
Client (Config config) | |
std::future< bool > | StartAsync () override |
bool | Initialized () const override |
class AllFlagsState | AllFlagsState (Context const &context, enum AllFlagsState::Options options=AllFlagsState::Options::Default) override |
void | Track (Context const &ctx, std::string event_name, Value data, double metric_value) override |
void | Track (Context const &ctx, std::string event_name, Value data) override |
void | Track (Context const &ctx, std::string event_name) override |
void | FlushAsync () override |
void | Identify (Context context) override |
bool | BoolVariation (Context const &ctx, FlagKey const &key, bool default_value) override |
EvaluationDetail< bool > | BoolVariationDetail (Context const &ctx, FlagKey const &key, bool default_value) override |
std::string | StringVariation (Context const &ctx, FlagKey const &key, std::string default_value) override |
EvaluationDetail< std::string > | StringVariationDetail (Context const &ctx, FlagKey const &key, std::string default_value) override |
double | DoubleVariation (Context const &ctx, FlagKey const &key, double default_value) override |
EvaluationDetail< double > | DoubleVariationDetail (Context const &ctx, FlagKey const &key, double default_value) override |
int | IntVariation (Context const &ctx, FlagKey const &key, int default_value) override |
EvaluationDetail< int > | IntVariationDetail (Context const &ctx, FlagKey const &key, int default_value) override |
Value | JsonVariation (Context const &ctx, FlagKey const &key, Value default_value) override |
EvaluationDetail< Value > | JsonVariationDetail (Context const &ctx, FlagKey const &key, Value default_value) override |
IDataSourceStatusProvider & | DataSourceStatus () override |
Public Member Functions inherited from launchdarkly::server_side::IClient | |
IClient (IClient const &item)=delete | |
IClient (IClient &&item)=delete | |
IClient & | operator= (IClient const &)=delete |
IClient & | operator= (IClient &&)=delete |
Static Public Member Functions | |
static char const * | Version () |
|
overridevirtual |
Evaluates all flags for a context, returning a data structure containing the results and additional flag metadata.
The method's behavior can be controlled by passing a combination of one or more options.
A common use-case for AllFlagsState is to generate data suitable for bootstrapping the client-side JavaScript SDK.
This method will not send analytics events back to LaunchDarkly.
context | The context against which all flags will be evaluated. |
options | A combination of one or more options. Omitting this argument is equivalent to passing AllFlagsState::Options::Default. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns the boolean value of a feature flag for a given flag key.
key | The unique feature key for the feature flag. |
default_value | The default value of the flag. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns the boolean value of a feature flag for a given flag key, in an object that also describes the way the value was determined.
key | The unique feature key for the feature flag. |
default_value | The default value of the flag. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns an interface which provides methods for subscribing to data source status.
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns the double value of a feature flag for a given flag key.
key | The unique feature key for the feature flag. |
default_value | The default value of the flag. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns the double value of a feature flag for a given flag key, in an object that also describes the way the value was determined.
key | The unique feature key for the feature flag. |
default_value | The default value of the flag. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Tells the client that all pending analytics events (if any) should be delivered as soon as possible.
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Generates an identify event for a context.
context | The new evaluation context. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns a boolean value indicating LaunchDarkly connection and flag state within the client.
When you first start the client, once StartAsync has completed, Initialized should return true if and only if either 1. it connected to LaunchDarkly and successfully retrieved flags, or 2. it started in offline mode so there's no need to connect to LaunchDarkly.
If the client timed out trying to connect to LD, then Initialized returns false (even if we do have cached flags). If the client connected and got a 401 error, Initialized will return false.
This serves the purpose of letting the app know that there was a problem of some kind.
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns the int value of a feature flag for a given flag key.
key | The unique feature key for the feature flag. |
default_value | The default value of the flag. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns the int value of a feature flag for a given flag key, in an object that also describes the way the value was determined.
key | The unique feature key for the feature flag. |
default_value | The default value of the flag. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns the JSON value of a feature flag for a given flag key.
key | The unique feature key for the feature flag. |
default_value | The default value of the flag. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns the JSON value of a feature flag for a given flag key, in an object that also describes the way the value was determined.
key | The unique feature key for the feature flag. |
default_value | The default value of the flag. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Connects the client to LaunchDarkly's flag delivery endpoints.
StartAsync must be called once for the SDK to start receiving flag data. It does not need to be called more than one time.
The returned future will resolve to true or false based on the logic outlined on Initialized.
Blocking indefinitely on the future (e.g. by calling .get() or .wait()) is highly discouraged. Instead, use a method that takes a timeout like .wait_for() or .wait_until(), or do not wait.
Otherwise, the application may hang indefinitely if the client cannot connect to LaunchDarkly.
While the client is connecting asynchronously, it is safe to call variation methods, which will return application-defined default values.
The client will always continue to attempt to connect asynchronously after being started unless it encounters an unrecoverable error. The returned promise timing out does not affect this behavior.
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns the string value of a feature flag for a given flag key.
key | The unique feature key for the feature flag. |
default_value | The default value of the flag. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Returns the string value of a feature flag for a given flag key, in an object that also describes the way the value was determined.
key | The unique feature key for the feature flag. |
default_value | The default value of the flag. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Tracks that the current context performed an event for the given event name.
event_name | The name of the event. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Tracks that the current context performed an event for the given event name, with additional JSON data.
event_name | The name of the event. |
data | A JSON value containing additional data associated with the event. |
Implements launchdarkly::server_side::IClient.
|
overridevirtual |
Tracks that the current context performed an event for the given event name, and associates it with a numeric metric value.
event_name | The name of the event. |
data | A JSON value containing additional data associated with the event. |
metric_value | this value is used by the LaunchDarkly experimentation feature in numeric custom metrics, and will also be returned as part of the custom event for Data Export |
Implements launchdarkly::server_side::IClient.
|
static |
Returns the version of the SDK.