Skip to content

feat: Add C bindings for Big Segments#573

Open
beekld wants to merge 1 commit into
mainfrom
beeklimt/SDK-2529/big-segments-c-bindings
Open

feat: Add C bindings for Big Segments#573
beekld wants to merge 1 commit into
mainfrom
beeklimt/SDK-2529/big-segments-c-bindings

Conversation

@beekld

@beekld beekld commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Exposes the Big Segments configuration and store-status surface in the C API. Adds:

  • LDServerBigSegmentsBuilder with ContextCacheSize, ContextCacheTimeMs, StatusPollIntervalMs, and StaleAfterMs setters.
  • LDServerBigSegmentStorePtr -- opaque store handle produced by integration libraries (e.g. the coming Redis and DynamoDB Big Segments sources) and consumed by LDServerBigSegmentsBuilder_New.
  • LDServerConfigBuilder_BigSegments, which attaches a Big Segments builder to the SDK config.
  • LDServerBigSegmentStoreStatus opaque handle with _Available and _Stale getters.
  • LDServerBigSegmentStoreStatusListener struct + _Init, LDServerSDK_BigSegmentStoreStatus_OnStatusChange, and LDServerSDK_BigSegmentStoreStatus_Status for status queries and change notifications.

Design decisions worth flagging:

  • The _Available / _Stale getters are bare predicates, not _IsAvailable / _IsStale. The C++ side uses IsAvailable() / IsStale(), but every existing C-binding bool-query in this repo drops that prefix -- LDServerSDK_Initialized, LDContext_Valid, and so on. The new C names follow that pattern.
  • ServerBigSegmentStoreStatusCallbackFn is the one exception to the LD / LDServer prefix rule. It mirrors the existing ServerDataSourceStatusCallbackFn typedef (sdk.h:863), which drops the prefix. New code matches that quirk to stay consistent within the same header.

Note

Low Risk
Additive public C API and binding glue only; no changes to evaluation or store logic beyond wiring existing C++ types. Main integration risk is correct store pointer lifetime when passed from future Redis/DynamoDB C integrations.

Overview
Adds C API surface for Big Segments on the server SDK, parallel to existing C++ BigSegmentsBuilder and data-source status patterns.

Configuration: New LDServerBigSegmentsBuilder wraps an integration-provided LDServerBigSegmentStorePtr (ownership transferred to the SDK) with tunables for context cache size/TTL, status poll interval, and stale-after threshold. LDServerConfigBuilder_BigSegments consumes the builder into the config, matching other consumed builders (FDv2, lazy load).

Runtime status: LDServerBigSegmentStoreStatus exposes _Available / _Stale predicates; LDServerSDK_BigSegmentStoreStatus_Status and listener APIs (LDServerBigSegmentStoreStatusListener, OnStatusChange) mirror the existing data-source status C bindings.

Implementation is thin C shims in big_segments_builder.cpp, builder.cpp, and sdk.cpp, plus binding tests for config attachment, default status when no store is configured, and listener registration.

Reviewed by Cursor Bugbot for commit 2f888ea. Bugbot is set up for automated code reviews on this repo. Configure here.

Base automatically changed from beeklimt/SDK-2528/fdv2-c-bindings to main July 1, 2026 18:14
@beekld beekld force-pushed the beeklimt/SDK-2529/big-segments-c-bindings branch from a42553c to bb517aa Compare July 1, 2026 18:56
@beekld beekld marked this pull request as ready for review July 1, 2026 18:58
@beekld beekld requested a review from a team as a code owner July 1, 2026 18:58
@beekld beekld force-pushed the beeklimt/SDK-2529/big-segments-c-bindings branch from bb517aa to 2f888ea Compare July 1, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant