C++ Client-Side SDK
LaunchDarkly SDK
Classes | Typedefs | Functions
builder.h File Reference
#include <launchdarkly/client_side/bindings/c/config/config.h>
#include <launchdarkly/bindings/c/config/logging_builder.h>
#include <launchdarkly/bindings/c/export.h>
#include <launchdarkly/bindings/c/status.h>
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for builder.h:

Go to the source code of this file.

Classes

struct  LDPersistence
 

Typedefs

typedef struct _LDClientConfigBuilder * LDClientConfigBuilder
 
typedef struct _LDDataSourceStreamBuilder * LDDataSourceStreamBuilder
 
typedef struct _LDDataSourcePollBuilder * LDDataSourcePollBuilder
 
typedef struct _LDPersistenceCustomBuilder * LDPersistenceCustomBuilder
 
typedef struct _LDClientHttpPropertiesTlsBuilder * LDClientHttpPropertiesTlsBuilder
 
typedef void(* SetFn) (char const *storage_namespace, char const *key, char const *data, void *user_data)
 
typedef void(* RemoveFn) (char const *storage_namespace, char const *key, void *user_data)
 
typedef size_t(* ReadFn) (char const *storage_namespace, char const *key, char const **read_value, void *user_data)
 
typedef void(* FreeFn) (char const *value, void *user_data)
 

Functions

 LDPersistence_Init (struct LDPersistence *implementation)
 
 LDClientConfigBuilder_New (char const *sdk_key)
 
 LDClientConfigBuilder_ServiceEndpoints_PollingBaseURL (LDClientConfigBuilder b, char const *url)
 
 LDClientConfigBuilder_ServiceEndpoints_StreamingBaseURL (LDClientConfigBuilder b, char const *url)
 
 LDClientConfigBuilder_ServiceEndpoints_EventsBaseURL (LDClientConfigBuilder b, char const *url)
 
 LDClientConfigBuilder_ServiceEndpoints_RelayProxyBaseURL (LDClientConfigBuilder b, char const *url)
 
 LDClientConfigBuilder_AppInfo_Identifier (LDClientConfigBuilder b, char const *app_id)
 
 LDClientConfigBuilder_AppInfo_Version (LDClientConfigBuilder b, char const *app_version)
 
 LDClientConfigBuilder_Offline (LDClientConfigBuilder b, bool offline)
 
 LDClientConfigBuilder_Events_Enabled (LDClientConfigBuilder b, bool enabled)
 
 LDClientConfigBuilder_Events_Capacity (LDClientConfigBuilder b, size_t capacity)
 
 LDClientConfigBuilder_Events_FlushIntervalMs (LDClientConfigBuilder b, unsigned int milliseconds)
 
 LDClientConfigBuilder_Events_AllAttributesPrivate (LDClientConfigBuilder b, bool all_attributes_private)
 
 LDClientConfigBuilder_Events_PrivateAttribute (LDClientConfigBuilder b, char const *attribute_reference)
 
 LDClientConfigBuilder_DataSource_WithReasons (LDClientConfigBuilder b, bool with_reasons)
 
 LDClientConfigBuilder_DataSource_UseReport (LDClientConfigBuilder b, bool use_report)
 
 LDClientConfigBuilder_DataSource_MethodStream (LDClientConfigBuilder b, LDDataSourceStreamBuilder stream_builder)
 
 LDClientConfigBuilder_DataSource_MethodPoll (LDClientConfigBuilder b, LDDataSourcePollBuilder poll_builder)
 
 LDDataSourceStreamBuilder_New ()
 
 LDDataSourceStreamBuilder_InitialReconnectDelayMs (LDDataSourceStreamBuilder b, unsigned int milliseconds)
 
 LDDataSourceStreamBuilder_Free (LDDataSourceStreamBuilder b)
 
 LDDataSourcePollBuilder_New ()
 
 LDDataSourcePollBuilder_IntervalS (LDDataSourcePollBuilder b, unsigned int seconds)
 
 LDDataSourcePollBuilder_Free (LDDataSourcePollBuilder b)
 
 LDClientConfigBuilder_HttpProperties_WrapperName (LDClientConfigBuilder b, char const *wrapper_name)
 
 LDClientConfigBuilder_HttpProperties_WrapperVersion (LDClientConfigBuilder b, char const *wrapper_version)
 
 LDClientConfigBuilder_HttpProperties_Header (LDClientConfigBuilder b, char const *key, char const *value)
 
 LDClientConfigBuilder_HttpProperties_Tls (LDClientConfigBuilder b, LDClientHttpPropertiesTlsBuilder tls_builder)
 
 LDClientHttpPropertiesTlsBuilder_New (void)
 
 LDClientHttpPropertiesTlsBuilder_Free (LDClientHttpPropertiesTlsBuilder b)
 
 LDClientHttpPropertiesTlsBuilder_SkipVerifyPeer (LDClientHttpPropertiesTlsBuilder b, bool skip_verify_peer)
 
 LDClientHttpPropertiesTlsBuilder_CustomCAFile (LDClientHttpPropertiesTlsBuilder b, char const *custom_ca_file)
 
 LDClientConfigBuilder_Logging_Disable (LDClientConfigBuilder b)
 
 LDClientConfigBuilder_Logging_Basic (LDClientConfigBuilder b, LDLoggingBasicBuilder basic_builder)
 
 LDClientConfigBuilder_Logging_Custom (LDClientConfigBuilder b, LDLoggingCustomBuilder custom_builder)
 
 LDPersistenceCustomBuilder_New ()
 
 LDPersistenceCustomBuilder_Free (LDPersistenceCustomBuilder b)
 
 LDPersistenceCustomBuilder_Implementation (LDPersistenceCustomBuilder b, struct LDPersistence impl)
 
 LDClientConfigBuilder_Persistence_Custom (LDClientConfigBuilder b, LDPersistenceCustomBuilder custom_builder)
 
 LDClientConfigBuilder_Persistence_None (LDClientConfigBuilder b)
 
 LDClientConfigBuilder_Build (LDClientConfigBuilder builder, LDClientConfig *out_config)
 
 LDClientConfigBuilder_Free (LDClientConfigBuilder builder)
 

Function Documentation

◆ LDClientConfigBuilder_AppInfo_Identifier()

LDClientConfigBuilder_AppInfo_Identifier ( LDClientConfigBuilder  b,
char const *  app_id 
)

Sets an identifier for the application.

Parameters
bClient config builder. Must not be NULL.
app_idNon-empty string. Must be <= 64 chars. Must be alphanumeric, '-', '.', or '_'. Must not be NULL.

◆ LDClientConfigBuilder_AppInfo_Version()

LDClientConfigBuilder_AppInfo_Version ( LDClientConfigBuilder  b,
char const *  app_version 
)

Sets a version for the application.

Parameters
bClient config builder. Must not be NULL.
app_versionNon-empty string. Must be <= 64 chars. Must be alphanumeric, '-', '.', or '_'. Must not be NULL.

◆ LDClientConfigBuilder_Build()

LDClientConfigBuilder_Build ( LDClientConfigBuilder  builder,
LDClientConfig *  out_config 
)

Creates an LDClientConfig. The LDClientConfigBuilder is consumed. On success, the config will be stored in out_config; otherwise, out_config will be set to NULL and the returned LDStatus will indicate the error.

Parameters
builderBuilder to consume. Must not be NULL.
out_configPointer to where the built config will be stored. Must not be NULL.
Returns
Error status on failure.

◆ LDClientConfigBuilder_DataSource_MethodPoll()

LDClientConfigBuilder_DataSource_MethodPoll ( LDClientConfigBuilder  b,
LDDataSourcePollBuilder  poll_builder 
)

Set the polling configuration for the builder.

A data source may either be streaming or polling. Setting a stream builder indicates the data source will use streaming. Setting a polling builder will indicate the use of polling.

Parameters
bClient config builder. Must not be NULL.
poll_builderThe polling builder. The builder is consumed; do not free it.

◆ LDClientConfigBuilder_DataSource_MethodStream()

LDClientConfigBuilder_DataSource_MethodStream ( LDClientConfigBuilder  b,
LDDataSourceStreamBuilder  stream_builder 
)

Set the streaming configuration for the builder.

A data source may either be streaming or polling. Setting a streaming builder indicates the data source will use streaming. Setting a polling builder will indicate the use of polling.

Parameters
bClient config builder. Must not be NULL.
stream_builderThe streaming builder. The builder is consumed; do not free it.

◆ LDClientConfigBuilder_DataSource_UseReport()

LDClientConfigBuilder_DataSource_UseReport ( LDClientConfigBuilder  b,
bool  use_report 
)

Whether or not to use the REPORT verb to fetch flag settings.

If this is true, flag settings will be fetched with a REPORT request including a JSON entity body with the context object.

Otherwise (by default) a GET request will be issued with the context passed as a base64 URL-encoded path parameter.

Do not use unless advised by LaunchDarkly.

Parameters
bClient config builder. Must not be NULL.
use_reasonsTrue to use the REPORT verb.

◆ LDClientConfigBuilder_DataSource_WithReasons()

LDClientConfigBuilder_DataSource_WithReasons ( LDClientConfigBuilder  b,
bool  with_reasons 
)
  • Whether LaunchDarkly should provide additional information about how flag values were calculated.

The additional information will then be available through the client's VariationDetail methods. Since this increases the size of network requests, such information is not sent unless you set this option to true.

Parameters
bClient config builder. Must not be NULL.
with_reasonsTrue to enable reasons.

◆ LDClientConfigBuilder_Events_AllAttributesPrivate()

LDClientConfigBuilder_Events_AllAttributesPrivate ( LDClientConfigBuilder  b,
bool  all_attributes_private 
)

Attribute privacy indicates whether or not attributes should be retained by LaunchDarkly after being sent upon initialization, and if attributes should later be sent in events.

Attribute privacy may be specified in 3 ways:

(1) To specify that all attributes should be considered private - not just those designated private on a per-context basis - call this method with true as the parameter.

(2) To specify that a specific set of attributes should be considered private - in addition to those designated private on a per-context basis

  • call PrivateAttribute.

(3) To specify private attributes on a per-context basis, it is not necessary to call either of these methods, as the default behavior is to treat all attributes as non-private unless otherwise specified.

Parameters
bClient config builder. Must not be NULL.
all_attributes_privateTrue for behavior of (1), false for default behavior of (2) or (3).

◆ LDClientConfigBuilder_Events_Capacity()

LDClientConfigBuilder_Events_Capacity ( LDClientConfigBuilder  b,
size_t  capacity 
)

Sets the capacity of the event processor. When more events are generated within the processor's flush interval than this value, events will be dropped.

Parameters
bClient config builder. Must not be NULL.
capacityEvent queue capacity.

◆ LDClientConfigBuilder_Events_Enabled()

LDClientConfigBuilder_Events_Enabled ( LDClientConfigBuilder  b,
bool  enabled 
)

Specify if event-sending should be enabled or not. By default, events are enabled.

Parameters
bClient config builder. Must not be NULL.
enabledTrue to enable event-sending.

◆ LDClientConfigBuilder_Events_FlushIntervalMs()

LDClientConfigBuilder_Events_FlushIntervalMs ( LDClientConfigBuilder  b,
unsigned int  milliseconds 
)

Sets the flush interval of the event processor. The processor queues outgoing events based on the capacity parameter; these events are then delivered based on the flush interval.

Parameters
bClient config builder. Must not be NULL.
millisecondsInterval between automatic flushes.

◆ LDClientConfigBuilder_Events_PrivateAttribute()

LDClientConfigBuilder_Events_PrivateAttribute ( LDClientConfigBuilder  b,
char const *  attribute_reference 
)

Specifies a single private attribute. May be called multiple times with additional private attributes.

Parameters
bClient config builder. Must not be NULL.
attribute_referenceAttribute to mark private.

◆ LDClientConfigBuilder_Free()

LDClientConfigBuilder_Free ( LDClientConfigBuilder  builder)

Frees the builder; only necessary if not calling Build.

Parameters
builderBuilder to free.

◆ LDClientConfigBuilder_HttpProperties_Header()

LDClientConfigBuilder_HttpProperties_Header ( LDClientConfigBuilder  b,
char const *  key,
char const *  value 
)

Set a custom header value. May be called more than once with additional headers.

Parameters
bClient config builder. Must not be NULL.
keyName of the header. Must not be NULL.
valueValue of the header. Must not be NULL.

◆ LDClientConfigBuilder_HttpProperties_Tls()

LDClientConfigBuilder_HttpProperties_Tls ( LDClientConfigBuilder  b,
LDClientHttpPropertiesTlsBuilder  tls_builder 
)

Sets the TLS options builder. The builder is consumed; do not free it.

Parameters
bClient config builder. Must not be NULL.
tls_builderThe TLS options builder. Must not be NULL.

◆ LDClientConfigBuilder_HttpProperties_WrapperName()

LDClientConfigBuilder_HttpProperties_WrapperName ( LDClientConfigBuilder  b,
char const *  wrapper_name 
)

This should be used for wrapper SDKs to set the wrapper name.

Wrapper information will be included in request headers.

Parameters
bClient config builder. Must not be NULL.
wrapper_nameName of the wrapper.

◆ LDClientConfigBuilder_HttpProperties_WrapperVersion()

LDClientConfigBuilder_HttpProperties_WrapperVersion ( LDClientConfigBuilder  b,
char const *  wrapper_version 
)

This should be used for wrapper SDKs to set the wrapper version.

Wrapper information will be included in request headers.

Parameters
bClient config builder. Must not be NULL.
wrapper_versionVersion of the wrapper.

◆ LDClientConfigBuilder_Logging_Basic()

LDClientConfigBuilder_Logging_Basic ( LDClientConfigBuilder  b,
LDLoggingBasicBuilder  basic_builder 
)

Configures the SDK with basic logging.

Parameters
bClient config builder. Must not be NULL.
basic_builderThe basic logging builder. Must not be NULL.

◆ LDClientConfigBuilder_Logging_Custom()

LDClientConfigBuilder_Logging_Custom ( LDClientConfigBuilder  b,
LDLoggingCustomBuilder  custom_builder 
)

Configures the SDK with custom logging.

Parameters
bClient config builder. Must not be NULL.
custom_builderThe custom logging builder. Must not be NULL.

◆ LDClientConfigBuilder_Logging_Disable()

LDClientConfigBuilder_Logging_Disable ( LDClientConfigBuilder  b)

Disables the default SDK logging.

Parameters
bClient config builder. Must not be NULL.

◆ LDClientConfigBuilder_New()

LDClientConfigBuilder_New ( char const *  sdk_key)

Constructs a client-side config builder.

◆ LDClientConfigBuilder_Offline()

LDClientConfigBuilder_Offline ( LDClientConfigBuilder  b,
bool  offline 
)

Enables or disables "Offline" mode. True means Offline mode is enabled.

Parameters
bClient config builder. Must not be NULL.
offlineTrue if offline.

◆ LDClientConfigBuilder_Persistence_Custom()

LDClientConfigBuilder_Persistence_Custom ( LDClientConfigBuilder  b,
LDPersistenceCustomBuilder  custom_builder 
)

Configures the SDK with custom persistence.

Parameters
bClient config builder. Must not be NULL.
custom_builderThe custom persistence builder. Must not be NULL.
Returns

◆ LDClientConfigBuilder_Persistence_None()

LDClientConfigBuilder_Persistence_None ( LDClientConfigBuilder  b)

Disables persistence.

Parameters
bClient config builder. Must not be NULL.

◆ LDClientConfigBuilder_ServiceEndpoints_EventsBaseURL()

LDClientConfigBuilder_ServiceEndpoints_EventsBaseURL ( LDClientConfigBuilder  b,
char const *  url 
)

Sets a custom URL for the events service.

Parameters
bClient config builder. Must not be NULL.
urlTarget URL. Must not be NULL.

◆ LDClientConfigBuilder_ServiceEndpoints_PollingBaseURL()

LDClientConfigBuilder_ServiceEndpoints_PollingBaseURL ( LDClientConfigBuilder  b,
char const *  url 
)

Sets a custom URL for the polling service.

Parameters
bClient config builder. Must not be NULL.
urlTarget URL. Must not be NULL.

◆ LDClientConfigBuilder_ServiceEndpoints_RelayProxyBaseURL()

LDClientConfigBuilder_ServiceEndpoints_RelayProxyBaseURL ( LDClientConfigBuilder  b,
char const *  url 
)

Sets a custom URL for a Relay Proxy instance. The streaming, polling, and events URLs are set automatically.

Parameters
bClient config builder. Must not be NULL.
urlTarget URL. Must not be NULL.

◆ LDClientConfigBuilder_ServiceEndpoints_StreamingBaseURL()

LDClientConfigBuilder_ServiceEndpoints_StreamingBaseURL ( LDClientConfigBuilder  b,
char const *  url 
)

Sets a custom URL for the streaming service.

Parameters
bClient config builder. Must not be NULL.
urlTarget URL. Must not be NULL.

◆ LDClientHttpPropertiesTlsBuilder_CustomCAFile()

LDClientHttpPropertiesTlsBuilder_CustomCAFile ( LDClientHttpPropertiesTlsBuilder  b,
char const *  custom_ca_file 
)

Configures TLS peer certificate verification to use a custom CA file.

The parameter is a filepath pointing to a bundle of one or more PEM-encoded x509 certificates comprising the root of trust for the SDK's outbound connections.

By default, the SDK uses the system's CA bundle. Passing the empty string will unset any previously set path and revert to the system's CA bundle.

Parameters
bClient config builder. Must not be NULL.
custom_ca_fileFilepath of the custom CA bundle, or empty string. Must not be NULL.

◆ LDClientHttpPropertiesTlsBuilder_Free()

LDClientHttpPropertiesTlsBuilder_Free ( LDClientHttpPropertiesTlsBuilder  b)

Frees a TLS options builder. Do not call if the builder was consumed by the HttpProperties builder.

Parameters
bBuilder to free.

◆ LDClientHttpPropertiesTlsBuilder_New()

LDClientHttpPropertiesTlsBuilder_New ( void  )

Creates a new TLS options builder for the HttpProperties builder.

If not passed into the HttpProperties builder, must be manually freed with LDClientHttpPropertiesTlsBuilder_Free.

Returns
New builder for TLS options.

◆ LDClientHttpPropertiesTlsBuilder_SkipVerifyPeer()

LDClientHttpPropertiesTlsBuilder_SkipVerifyPeer ( LDClientHttpPropertiesTlsBuilder  b,
bool  skip_verify_peer 
)

Configures TLS peer certificate verification. Peer verification is enabled by default.

Disabling peer verification is not recommended unless a specific use-case calls for it.

Parameters
bClient config builder. Must not be NULL.
skip_verify_peerTrue to skip verification.

◆ LDDataSourcePollBuilder_Free()

LDDataSourcePollBuilder_Free ( LDDataSourcePollBuilder  b)

Frees a Polling method builder. Do not call if the builder was consumed by the config builder.

Parameters
bBuilder to free.

◆ LDDataSourcePollBuilder_IntervalS()

LDDataSourcePollBuilder_IntervalS ( LDDataSourcePollBuilder  b,
unsigned int  seconds 
)

Sets the interval at which the SDK will poll for feature flag updates.

Parameters
bPolling method builder. Must not be NULL.
millisecondsPolling interval.

◆ LDDataSourcePollBuilder_New()

LDDataSourcePollBuilder_New ( )

Creates a new DataSource builder for the Polling method.

If not passed into the config builder, must be manually freed with LDDataSourcePollBuilder_Free.

Returns
New builder for Polling method.

◆ LDDataSourceStreamBuilder_Free()

LDDataSourceStreamBuilder_Free ( LDDataSourceStreamBuilder  b)

Frees a Streaming method builder. Do not call if the builder was consumed by the config builder.

Parameters
bBuilder to free.

◆ LDDataSourceStreamBuilder_InitialReconnectDelayMs()

LDDataSourceStreamBuilder_InitialReconnectDelayMs ( LDDataSourceStreamBuilder  b,
unsigned int  milliseconds 
)

Sets the initial reconnect delay for the streaming connection.

The streaming service uses a backoff algorithm (with jitter) every time the connection needs to be reestablished.The delay for the first reconnection will start near this value, and then increase exponentially for any subsequent connection failures.

Parameters
bStreaming method builder. Must not be NULL.
millisecondsInitial delay for a reconnection attempt.

◆ LDDataSourceStreamBuilder_New()

LDDataSourceStreamBuilder_New ( )

Creates a new DataSource builder for the Streaming method.

If not passed into the config builder, must be manually freed with LDDataSourceStreamBuilder_Free.

Returns
New builder for Streaming method.

◆ LDPersistence_Init()

LDPersistence_Init ( struct LDPersistence implementation)

Initializes a custom persistence implementation. Must be called before passing a custom implementation into configuration.

Parameters
backendImplementation to initialize.

◆ LDPersistenceCustomBuilder_Free()

LDPersistenceCustomBuilder_Free ( LDPersistenceCustomBuilder  b)

Frees a custom persistence builder. Do not call if the builder was consumed by the config builder.

Parameters
bBuilder to free.

◆ LDPersistenceCustomBuilder_Implementation()

LDPersistenceCustomBuilder_Implementation ( LDPersistenceCustomBuilder  b,
struct LDPersistence  impl 
)

Sets a custom persistence implementation.

Parameters
bCustom persistence builder. Must not be NULL.
implThe implementation to use for persistence. Ensure the implementation was initialized with LDPersistence_Init.

◆ LDPersistenceCustomBuilder_New()

LDPersistenceCustomBuilder_New ( )

Creates a new builder for a custom, user-provided persistence.

If not passed into the config builder, must be manually freed with LDPersistenceCustomBuilder_Free.

Returns
New builder.