Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions components-rs/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,8 @@ typedef struct ddog_DslString ddog_DslString;
*/
typedef struct ddog_FfeCdnConfig ddog_FfeCdnConfig;

typedef struct ddog_FfeEvaluation ddog_FfeEvaluation;

typedef struct ddog_FfeFeatures ddog_FfeFeatures;

/**
Expand Down Expand Up @@ -599,6 +601,30 @@ typedef struct ddog_DsmIdentity {
ddog_CharSlice base_hash;
} ddog_DsmIdentity;

/**
* All slices and features are borrowed until ddog_ffe_evaluation_drop.
* NULL slices mean absent strings; non-NULL empty slices mean empty strings.
*/
typedef struct ddog_FfeResultView {
ddog_CharSlice value_json;
ddog_CharSlice variant;
ddog_CharSlice allocation_key;
int32_t reason;
int32_t error_code;
int32_t serial_id;
bool has_serial_id;
bool do_log;
bool observe_full_evaluation_data;
bool valid;
const struct ddog_FfeFeatures *features;
} ddog_FfeResultView;

typedef struct ddog_FfeDependencyView {
ddog_CharSlice key;
struct ddog_FfeResultView result;
bool exposure_eligible;
} ddog_FfeDependencyView;

typedef struct ddog_FfeFeature {
ddog_CharSlice key;
/**
Expand All @@ -611,23 +637,6 @@ typedef struct ddog_FfeFeature {
uintptr_t destinations_count;
} ddog_FfeFeature;

typedef struct ddog_FfeResult {
_zend_string * value_json;
_zend_string * variant;
_zend_string * allocation_key;
int32_t reason;
int32_t error_code;
int32_t serial_id;
bool has_serial_id;
bool do_log;
bool observe_full_evaluation_data;
bool valid;
/**
* NULL when the selected split has no features. Release with ddog_ffe_features_drop.
*/
struct ddog_FfeFeatures *features;
} ddog_FfeResult;

typedef struct ddog_FfeAttribute {
ddog_CharSlice key;
int32_t value_type;
Expand Down
28 changes: 21 additions & 7 deletions components-rs/datadog.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,18 @@ void ddog_ffe_cdn_config_drop(struct ddog_FfeCdnConfig*);
*/
struct ddog_Endpoint *ddog_ffe_evp_endpoint_new(ddog_CharSlice site, ddog_CharSlice api_key);

struct ddog_FfeResultView ddog_ffe_evaluation_result(const struct ddog_FfeEvaluation *evaluation);

uintptr_t ddog_ffe_evaluation_dependencies_count(const struct ddog_FfeEvaluation *evaluation);

/**
* An out-of-range index returns an invalid result and an empty key.
*/
struct ddog_FfeDependencyView ddog_ffe_evaluation_dependency_get(const struct ddog_FfeEvaluation *evaluation,
uintptr_t index);

void ddog_ffe_evaluation_drop(struct ddog_FfeEvaluation *evaluation);

uintptr_t ddog_ffe_features_count(const struct ddog_FfeFeatures *features);

/**
Expand All @@ -311,13 +323,15 @@ ddog_CharSlice ddog_ffe_features_destination(const struct ddog_FfeFeatures *feat
uintptr_t index,
uintptr_t destination);

void ddog_ffe_features_drop(struct ddog_FfeFeatures *features);

struct ddog_FfeResult ddog_ffe_evaluate(ddog_CharSlice flag_key,
int32_t expected_type,
ddog_CharSlice targeting_key,
const struct ddog_FfeAttribute *attributes,
uintptr_t attributes_count);
/**
* Build an owned snapshot; conversion to Zend values happens in C after return.
* Release with ddog_ffe_evaluation_drop, including if C bails out consuming it.
*/
struct ddog_FfeEvaluation *ddog_ffe_evaluate(ddog_CharSlice flag_key,
int32_t expected_type,
ddog_CharSlice targeting_key,
const struct ddog_FfeAttribute *attributes,
uintptr_t attributes_count);

void ddog_init_remote_config(struct ddog_RemoteConfigFlags flags);

Expand Down
Loading
Loading