C++ Server-Side SDK
LaunchDarkly SDK
Typedefs | Functions
fdv2_builder.h File Reference
#include <launchdarkly/bindings/c/export.h>
#include <stdbool.h>
Include dependency graph for fdv2_builder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct _LDServerFDv2Builder * LDServerFDv2Builder
 
typedef struct _LDServerFDv2StreamingBuilder * LDServerFDv2StreamingBuilder
 
typedef struct _LDServerFDv2PollingBuilder * LDServerFDv2PollingBuilder
 
typedef struct _LDServerDataSourceStreamBuilder * LDServerDataSourceStreamBuilder
 
typedef struct _LDServerDataSourcePollBuilder * LDServerDataSourcePollBuilder
 

Functions

 LDServerFDv2Builder_Default (void)
 
 LDServerFDv2Builder_Custom (void)
 
 LDServerFDv2Builder_Free (LDServerFDv2Builder b)
 
 LDServerFDv2StreamingBuilder_New (void)
 
 LDServerFDv2StreamingBuilder_InitialReconnectDelayMs (LDServerFDv2StreamingBuilder b, unsigned int milliseconds)
 
 LDServerFDv2StreamingBuilder_BaseURL (LDServerFDv2StreamingBuilder b, char const *base_url)
 
 LDServerFDv2StreamingBuilder_Free (LDServerFDv2StreamingBuilder b)
 
 LDServerFDv2PollingBuilder_New (void)
 
 LDServerFDv2PollingBuilder_IntervalS (LDServerFDv2PollingBuilder b, unsigned int seconds)
 
 LDServerFDv2PollingBuilder_BaseURL (LDServerFDv2PollingBuilder b, char const *base_url)
 
 LDServerFDv2PollingBuilder_Free (LDServerFDv2PollingBuilder b)
 
 LDServerFDv2Builder_Initializer_Polling (LDServerFDv2Builder b, LDServerFDv2PollingBuilder polling)
 
 LDServerFDv2Builder_Synchronizer_Streaming (LDServerFDv2Builder b, LDServerFDv2StreamingBuilder streaming)
 
 LDServerFDv2Builder_Synchronizer_Polling (LDServerFDv2Builder b, LDServerFDv2PollingBuilder polling)
 
 LDServerFDv2Builder_FDv1Fallback_Streaming (LDServerFDv2Builder b, LDServerDataSourceStreamBuilder fdv1_streaming)
 
 LDServerFDv2Builder_FDv1Fallback_Polling (LDServerFDv2Builder b, LDServerDataSourcePollBuilder fdv1_polling)
 
 LDServerFDv2Builder_DisableFDv1Fallback (LDServerFDv2Builder b)
 
 LDServerFDv2Builder_FallbackTimeoutMs (LDServerFDv2Builder b, unsigned int milliseconds)
 
 LDServerFDv2Builder_RecoveryTimeoutMs (LDServerFDv2Builder b, unsigned int milliseconds)
 

Function Documentation

◆ LDServerFDv2Builder_Custom()

LDServerFDv2Builder_Custom ( void  )

Creates an FDv2 builder with no initializers, no synchronizers, and no FDv1 fallback. Sources must be added explicitly via Initializer_*, Synchronizer_*, and FDv1Fallback_* methods.

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

Returns
A new empty FDv2 builder.

◆ LDServerFDv2Builder_Default()

LDServerFDv2Builder_Default ( void  )

Creates an FDv2 builder pre-populated with the spec-recommended initializers, synchronizers, and FDv1 fallback. Suitable for most applications without further configuration.

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

Returns
A new FDv2 builder with default sources.

◆ LDServerFDv2Builder_DisableFDv1Fallback()

LDServerFDv2Builder_DisableFDv1Fallback ( LDServerFDv2Builder  b)

Disables the FDv1 fallback. After this call, an FDv1 fallback directive from the service leaves the data source in the interrupted state and schedules an FDv2 retry on the directive's TTL.

Parameters
bFDv2 builder. Must not be NULL.

◆ LDServerFDv2Builder_FallbackTimeoutMs()

LDServerFDv2Builder_FallbackTimeoutMs ( LDServerFDv2Builder  b,
unsigned int  milliseconds 
)

Sets how long the active synchronizer may remain interrupted before the orchestrator falls back to the next-preferred synchronizer.

Parameters
bFDv2 builder. Must not be NULL.
millisecondsDuration the synchronizer must be continuously interrupted for before fallback fires.

◆ LDServerFDv2Builder_FDv1Fallback_Polling()

LDServerFDv2Builder_FDv1Fallback_Polling ( LDServerFDv2Builder  b,
LDServerDataSourcePollBuilder  fdv1_polling 
)

Configures the FDv1 polling source used as a last-resort fallback when the LaunchDarkly service signals (via the X-LD-FD-Fallback header) that the SDK should switch to FDv1. The fallback reads its endpoint from the top-level ServiceEndpoints configuration. The source builder is automatically freed.

The fdv1_polling parameter uses the same handle type as the BackgroundSync polling synchronizer (LDServerDataSourcePollBuilder_New); the underlying C++ type is shared.

WARNING: Do not call any other LDServerDataSourcePollBuilder function on the provided builder after calling this function. It is undefined behavior.

Parameters
bFDv2 builder. Must not be NULL.
fdv1_pollingThe FDv1 Polling source builder. The builder is consumed; do not free it. Must not be NULL.

◆ LDServerFDv2Builder_FDv1Fallback_Streaming()

LDServerFDv2Builder_FDv1Fallback_Streaming ( LDServerFDv2Builder  b,
LDServerDataSourceStreamBuilder  fdv1_streaming 
)

Configures the FDv1 streaming source used as a last-resort fallback when the LaunchDarkly service signals (via the X-LD-FD-Fallback header) that the SDK should switch to FDv1. The fallback reads its endpoint from the top-level ServiceEndpoints configuration. The source builder is automatically freed.

The fdv1_streaming parameter uses the same handle type as the BackgroundSync streaming synchronizer (LDServerDataSourceStreamBuilder_New); the underlying C++ type is shared.

WARNING: Do not call any other LDServerDataSourceStreamBuilder function on the provided builder after calling this function. It is undefined behavior.

Parameters
bFDv2 builder. Must not be NULL.
fdv1_streamingThe FDv1 Streaming source builder. The builder is consumed; do not free it. Must not be NULL.

◆ LDServerFDv2Builder_Free()

LDServerFDv2Builder_Free ( LDServerFDv2Builder  b)

Frees an FDv2 builder. Do not call if the builder was consumed by the config builder.

Parameters
bBuilder to free.

◆ LDServerFDv2Builder_Initializer_Polling()

LDServerFDv2Builder_Initializer_Polling ( LDServerFDv2Builder  b,
LDServerFDv2PollingBuilder  polling 
)

Appends an FDv2 polling initializer to the FDv2 builder's initializers list. The source builder is automatically freed.

WARNING: Do not call any other LDServerFDv2PollingBuilder function on the provided builder after calling this function. It is undefined behavior.

Parameters
bFDv2 builder. Must not be NULL.
pollingThe FDv2 Polling source builder. The builder is consumed; do not free it. Must not be NULL.

◆ LDServerFDv2Builder_RecoveryTimeoutMs()

LDServerFDv2Builder_RecoveryTimeoutMs ( LDServerFDv2Builder  b,
unsigned int  milliseconds 
)

Sets how long a fallback synchronizer must run successfully before the orchestrator attempts to recover to the primary synchronizer.

Parameters
bFDv2 builder. Must not be NULL.
millisecondsDuration the fallback synchronizer must run before a recovery attempt is made.

◆ LDServerFDv2Builder_Synchronizer_Polling()

LDServerFDv2Builder_Synchronizer_Polling ( LDServerFDv2Builder  b,
LDServerFDv2PollingBuilder  polling 
)

Appends an FDv2 polling synchronizer to the FDv2 builder's synchronizers list. The source builder is automatically freed.

See LDServerFDv2Builder_Synchronizer_Streaming for ordering semantics.

WARNING: Do not call any other LDServerFDv2PollingBuilder function on the provided builder after calling this function. It is undefined behavior.

Parameters
bFDv2 builder. Must not be NULL.
pollingThe FDv2 Polling source builder. The builder is consumed; do not free it. Must not be NULL.

◆ LDServerFDv2Builder_Synchronizer_Streaming()

LDServerFDv2Builder_Synchronizer_Streaming ( LDServerFDv2Builder  b,
LDServerFDv2StreamingBuilder  streaming 
)

Appends an FDv2 streaming synchronizer to the FDv2 builder's synchronizers list. The source builder is automatically freed.

Order in the list determines preference: the first entry is the primary synchronizer, subsequent entries are fallbacks.

WARNING: Do not call any other LDServerFDv2StreamingBuilder function on the provided builder after calling this function. It is undefined behavior.

Parameters
bFDv2 builder. Must not be NULL.
streamingThe FDv2 Streaming source builder. The builder is consumed; do not free it. Must not be NULL.

◆ LDServerFDv2PollingBuilder_BaseURL()

LDServerFDv2PollingBuilder_BaseURL ( LDServerFDv2PollingBuilder  b,
char const *  base_url 
)

Overrides the base URL used by this FDv2 polling source. By default the polling source reads its endpoint from the top-level ServiceEndpoints configuration; this override takes precedence for this source only.

Parameters
bFDv2 Polling source builder. Must not be NULL.
base_urlTarget URL. Must not be NULL.

◆ LDServerFDv2PollingBuilder_Free()

LDServerFDv2PollingBuilder_Free ( LDServerFDv2PollingBuilder  b)

Frees an FDv2 Polling source builder. Do not call if the builder was consumed by an FDv2 builder.

Parameters
bBuilder to free.

◆ LDServerFDv2PollingBuilder_IntervalS()

LDServerFDv2PollingBuilder_IntervalS ( LDServerFDv2PollingBuilder  b,
unsigned int  seconds 
)

Sets the interval at which this FDv2 polling source will poll for flag updates.

Parameters
bFDv2 Polling source builder. Must not be NULL.
secondsPolling interval in seconds.

◆ LDServerFDv2PollingBuilder_New()

LDServerFDv2PollingBuilder_New ( void  )

Creates a new FDv2 Polling source builder.

If not passed into an FDv2 builder, must be manually freed with LDServerFDv2PollingBuilder_Free.

Returns
A new FDv2 Polling source builder.

◆ LDServerFDv2StreamingBuilder_BaseURL()

LDServerFDv2StreamingBuilder_BaseURL ( LDServerFDv2StreamingBuilder  b,
char const *  base_url 
)

Overrides the base URL used by this FDv2 streaming source. By default the streaming source reads its endpoint from the top-level ServiceEndpoints configuration; this override takes precedence for this source only.

Parameters
bFDv2 Streaming source builder. Must not be NULL.
base_urlTarget URL. Must not be NULL.

◆ LDServerFDv2StreamingBuilder_Free()

LDServerFDv2StreamingBuilder_Free ( LDServerFDv2StreamingBuilder  b)

Frees an FDv2 Streaming source builder. Do not call if the builder was consumed by an FDv2 builder.

Parameters
bBuilder to free.

◆ LDServerFDv2StreamingBuilder_InitialReconnectDelayMs()

LDServerFDv2StreamingBuilder_InitialReconnectDelayMs ( LDServerFDv2StreamingBuilder  b,
unsigned int  milliseconds 
)

Sets the initial reconnect delay for the FDv2 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
bFDv2 Streaming source builder. Must not be NULL.
millisecondsInitial delay for a reconnection attempt.

◆ LDServerFDv2StreamingBuilder_New()

LDServerFDv2StreamingBuilder_New ( void  )

Creates a new FDv2 Streaming source builder.

If not passed into an FDv2 builder, must be manually freed with LDServerFDv2StreamingBuilder_Free.

Returns
A new FDv2 Streaming source builder.