feat: Add C bindings for Big Segments#573
Open
beekld wants to merge 1 commit into
Open
Conversation
a42553c to
bb517aa
Compare
bb517aa to
2f888ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes the Big Segments configuration and store-status surface in the C API. Adds:
LDServerBigSegmentsBuilderwithContextCacheSize,ContextCacheTimeMs,StatusPollIntervalMs, andStaleAfterMssetters.LDServerBigSegmentStorePtr-- opaque store handle produced by integration libraries (e.g. the coming Redis and DynamoDB Big Segments sources) and consumed byLDServerBigSegmentsBuilder_New.LDServerConfigBuilder_BigSegments, which attaches a Big Segments builder to the SDK config.LDServerBigSegmentStoreStatusopaque handle with_Availableand_Stalegetters.LDServerBigSegmentStoreStatusListenerstruct +_Init,LDServerSDK_BigSegmentStoreStatus_OnStatusChange, andLDServerSDK_BigSegmentStoreStatus_Statusfor status queries and change notifications.Design decisions worth flagging:
_Available/_Stalegetters are bare predicates, not_IsAvailable/_IsStale. The C++ side usesIsAvailable()/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.ServerBigSegmentStoreStatusCallbackFnis the one exception to theLD/LDServerprefix rule. It mirrors the existingServerDataSourceStatusCallbackFntypedef (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++
BigSegmentsBuilderand data-source status patterns.Configuration: New
LDServerBigSegmentsBuilderwraps an integration-providedLDServerBigSegmentStorePtr(ownership transferred to the SDK) with tunables for context cache size/TTL, status poll interval, and stale-after threshold.LDServerConfigBuilder_BigSegmentsconsumes the builder into the config, matching other consumed builders (FDv2, lazy load).Runtime status:
LDServerBigSegmentStoreStatusexposes_Available/_Stalepredicates;LDServerSDK_BigSegmentStoreStatus_Statusand listener APIs (LDServerBigSegmentStoreStatusListener,OnStatusChange) mirror the existing data-source status C bindings.Implementation is thin C shims in
big_segments_builder.cpp,builder.cpp, andsdk.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.