|
C++ Server-Side SDK
LaunchDarkly SDK
|
C bindings for hook data passed between evaluation stages. More...
#include <launchdarkly/bindings/c/export.h>#include <launchdarkly/bindings/c/context.h>#include <stdbool.h>#include <stddef.h>
Go to the source code of this file.
Typedefs | |
| typedef struct p_LDServerSDKEvaluationSeriesData * | LDServerSDKEvaluationSeriesData |
| typedef struct p_LDEvaluationSeriesDataBuilder * | LDServerSDKEvaluationSeriesDataBuilder |
Functions | |
| LDEvaluationSeriesData_New (void) | |
| Create a new empty evaluation series data. More... | |
| LDEvaluationSeriesData_GetValue (LDServerSDKEvaluationSeriesData data, char const *key, LDValue *out_value) | |
| Get a Value from the evaluation series data. More... | |
| LDEvaluationSeriesData_GetPointer (LDServerSDKEvaluationSeriesData data, char const *key, void **out_pointer) | |
| Get a pointer from the evaluation series data. More... | |
| LDEvaluationSeriesData_NewBuilder (LDServerSDKEvaluationSeriesData data) | |
| Create a builder from existing data. More... | |
| LDEvaluationSeriesData_Free (LDServerSDKEvaluationSeriesData data) | |
| Free evaluation series data. More... | |
| LDEvaluationSeriesDataBuilder_SetValue (LDServerSDKEvaluationSeriesDataBuilder builder, char const *key, LDValue value) | |
| Set a Value in the builder. More... | |
| LDEvaluationSeriesDataBuilder_SetPointer (LDServerSDKEvaluationSeriesDataBuilder builder, char const *key, void *pointer) | |
| Set a pointer in the builder. More... | |
| LDEvaluationSeriesDataBuilder_Build (LDServerSDKEvaluationSeriesDataBuilder builder) | |
| Build the evaluation series data. More... | |
| LDEvaluationSeriesDataBuilder_Free (LDServerSDKEvaluationSeriesDataBuilder builder) | |
| Free a builder without building. More... | |
C bindings for hook data passed between evaluation stages.
EvaluationSeriesData is mutable data that hooks can use to pass information from beforeEvaluation to afterEvaluation. This is useful for:
LIFETIME AND OWNERSHIP:
BUILDER PATTERN: To modify data, use LDEvaluationSeriesData_NewBuilder() to create a builder, make changes, then build a new data object.
| LDEvaluationSeriesData_Free | ( | LDServerSDKEvaluationSeriesData | data | ) |
Free evaluation series data.
Only call this if you created the data and are not returning it from a hook callback. Data returned from callbacks is owned by the SDK.
| data | Data to free. May be NULL (no-op). |
| LDEvaluationSeriesData_GetPointer | ( | LDServerSDKEvaluationSeriesData | data, |
| char const * | key, | ||
| void ** | out_pointer | ||
| ) |
Get a pointer from the evaluation series data.
Retrieves a pointer previously stored with LDEvaluationSeriesDataBuilder_SetPointer().
USAGE - OpenTelemetry span:
| data | Data object. Must not be NULL. |
| key | Key to look up. Must be null-terminated UTF-8 string. Must not be NULL. |
| out_pointer | Pointer to receive the pointer value. Must not be NULL. Set to NULL if key not found. |
| LDEvaluationSeriesData_GetValue | ( | LDServerSDKEvaluationSeriesData | data, |
| char const * | key, | ||
| LDValue * | out_value | ||
| ) |
Get a Value from the evaluation series data.
LIFETIME: Returns a temporary value valid only during the callback. Do not call LDValue_Free() on the returned value.
USAGE:
| data | Data object. Must not be NULL. |
| key | Key to look up. Must be null-terminated UTF-8 string. Must not be NULL. |
| out_value | Pointer to receive the value. Must not be NULL. Set to a temporary LDValue (valid only during callback). Do not call LDValue_Free() on this value. |
| LDEvaluationSeriesData_New | ( | void | ) |
Create a new empty evaluation series data.
| LDEvaluationSeriesData_NewBuilder | ( | LDServerSDKEvaluationSeriesData | data | ) |
Create a builder from existing data.
Creates a builder initialized with the contents of the data object. Use this to add or modify entries in the data.
USAGE:
| data | Data to copy into builder. May be NULL (creates empty builder). |
| LDEvaluationSeriesDataBuilder_Build | ( | LDServerSDKEvaluationSeriesDataBuilder | builder | ) |
Build the evaluation series data.
Consumes the builder and creates a data object. After calling this, do not call LDEvaluationSeriesDataBuilder_Free() on the builder.
| builder | Builder to consume. Must not be NULL. |
| LDEvaluationSeriesDataBuilder_Free | ( | LDServerSDKEvaluationSeriesDataBuilder | builder | ) |
Free a builder without building.
Only call this if you did not call LDEvaluationSeriesDataBuilder_Build().
| builder | Builder to free. May be NULL (no-op). |
| LDEvaluationSeriesDataBuilder_SetPointer | ( | LDServerSDKEvaluationSeriesDataBuilder | builder, |
| char const * | key, | ||
| void * | pointer | ||
| ) |
Set a pointer in the builder.
Stores an application-specific pointer. Useful for storing objects like OpenTelemetry spans that need to be passed from beforeEvaluation to afterEvaluation.
LIFETIME: The pointer lifetime must extend through the evaluation series (from beforeEvaluation through afterEvaluation).
EXAMPLE - OpenTelemetry span:
| builder | Builder object. Must not be NULL. |
| key | Key for the pointer. Must be null-terminated UTF-8 string. Must not be NULL. The key is copied. |
| pointer | Pointer to store. May be NULL. Lifetime managed by caller. |
| LDEvaluationSeriesDataBuilder_SetValue | ( | LDServerSDKEvaluationSeriesDataBuilder | builder, |
| char const * | key, | ||
| LDValue | value | ||
| ) |
Set a Value in the builder.
OWNERSHIP: The value is copied/moved into the builder. You are responsible for freeing the original value if needed.
| builder | Builder object. Must not be NULL. |
| key | Key for the value. Must be null-terminated UTF-8 string. Must not be NULL. The key is copied. |
| value | Value to store. Must not be NULL. The value is copied/moved. |