Skip to content

feat: Add C bindings for Big Segments#573

Merged
beekld merged 2 commits into
mainfrom
beeklimt/SDK-2529/big-segments-c-bindings
Jul 24, 2026
Merged

feat: Add C bindings for Big Segments#573
beekld merged 2 commits 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
New public C headers and thin wrappers over existing C++ Big Segments code; no changes to evaluation or auth paths beyond enabling C consumers to configure the feature.

Overview
Exposes Big Segments on the server-side C API, wiring C callers into the existing C++ BigSegmentsBuilder and store-status types.

Configuration: New LDServerBigSegmentsBuilder wraps an opaque LDServerBigSegmentStorePtr from integration libraries, with setters for context cache size/TTL, status poll interval, and staleness threshold. LDServerConfigBuilder_BigSegments consumes the builder into the SDK config (same consume-and-free pattern as FDv2/lazy load).

Observability: Adds LDServerBigSegmentStoreStatus with Available / Stale predicates, plus listener APIs (LDServerBigSegmentStoreStatusListener, LDServerSDK_BigSegmentStoreStatus_OnStatusChange, LDServerSDK_BigSegmentStoreStatus_Status) aligned with the existing data source status bindings.

Implementation lives in big_segments_builder.cpp and extensions to builder.cpp / sdk.cpp; binding tests cover config attachment, default status when no store is configured, and listener registration.

Reviewed by Cursor Bugbot for commit 897f191. 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
LDServerSDK_Free(sdk);
}

void BigSegmentStoreStatusListenerFunction(LDServerBigSegmentStoreStatus,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this function validate the content of the user pointer. Ensure the integrity of the cabbages?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@beekld
beekld merged commit 948878e into main Jul 24, 2026
49 checks passed
@beekld
beekld deleted the beeklimt/SDK-2529/big-segments-c-bindings branch July 24, 2026 20:29
@github-actions github-actions Bot mentioned this pull request Jul 24, 2026
beekld added a commit that referenced this pull request Jul 24, 2026
## Summary

Adds a C binding for `RedisBigSegmentStore` so C callers can wire the
existing Redis Big Segments integration into the SDK's Big Segments
config.

New public surface:

- `LDServerBigSegmentsRedisStore` opaque handle.
- `struct LDServerBigSegmentsRedisResult` with `store` and
`error_message` fields.
- `LDSERVER_BIGSEGMENTS_REDISSTORE_ERROR_MESSAGE_SIZE` macro.
- `LDServerBigSegmentsRedisStore_New(uri, prefix, out_result)` factory.
- `LDServerBigSegmentsRedisStore_Free(store)`.

Tests:

- Unit tests for successful creation, failure error propagation, and
null-store on failure.
- End-to-end test against a live Redis: primes a sync timestamp, wires
the store through the C API, and verifies the SDK reports the store
available via the Big Segment status listener.

Design decision worth flagging: the type name uses config-section-first
word order (`BigSegments` + `Redis` + `Store`) to mirror the existing
Redis LazyLoad C binding's `LDServerLazyLoadRedisSource` (`LazyLoad` +
`Redis` + `Source`). This differs from the C++ class name
`RedisBigSegmentStore` -- a literal C++ mirror would have been
`LDServerRedisBigSegmentStore`. Chose consistency with the sibling C
binding in the same header directory over C++ class-name parity.

Stacked on #573 (Big Segments C bindings). Please review that PR first.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Additive public C surface and binding glue over existing C++ store
logic; main risk is caller misuse of ownership (free vs hand off to
SDK), which is documented and covered by tests.
> 
> **Overview**
> Exposes the existing C++ `RedisBigSegmentStore` to C callers via a new
public header and thin wrapper, following the same **result struct +
`_New` / `_Free`** pattern as `LDServerLazyLoadRedisSource`.
> 
> The new API adds `LDServerBigSegmentsRedisStore_New(uri, prefix,
out_result)` (returns store pointer or copies a truncated error into a
fixed buffer), `LDServerBigSegmentsRedisStore_Free`, and documents
ownership transfer when the handle is passed into
`LDServerBigSegmentsBuilder_New`. The binding implementation delegates
to `RedisBigSegmentStore::Create` and is wired into the
`server-sdk-redis-source` library build.
> 
> Tests cover success/failure creation behavior and an **end-to-end**
path: Redis is primed with `big_segments_synchronized_on`, the store is
attached through the C Big Segments config builder, and the SDK’s Big
Segment store status listener is asserted to report **available**.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d72a78b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
beekld pushed a commit that referenced this pull request Jul 24, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>launchdarkly-cpp-client: 3.11.3</summary>

##
[3.11.3](launchdarkly-cpp-client-v3.11.2...launchdarkly-cpp-client-v3.11.3)
(2026-07-24)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/cpp-internal bumped from 0.14.0 to 0.14.1
</details>

<details><summary>launchdarkly-cpp-internal: 0.14.1</summary>

##
[0.14.1](launchdarkly-cpp-internal-v0.14.0...launchdarkly-cpp-internal-v0.14.1)
(2026-07-24)


### Bug Fixes

* Redact anonymous context attributes in server-side custom events
([#583](#583))
([55f7eaf](55f7eaf))
</details>

<details><summary>launchdarkly-cpp-server: 3.13.0</summary>

##
[3.13.0](launchdarkly-cpp-server-v3.12.0...launchdarkly-cpp-server-v3.13.0)
(2026-07-24)


### Features

* Add C bindings for Big Segments
([#573](#573))
([948878e](948878e))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/cpp-internal bumped from 0.14.0 to 0.14.1
</details>

<details><summary>launchdarkly-cpp-server-dynamodb-source:
0.3.0</summary>

##
[0.3.0](launchdarkly-cpp-server-dynamodb-source-v0.2.1...launchdarkly-cpp-server-dynamodb-source-v0.3.0)
(2026-07-24)


### Features

* Add C bindings for DynamoDB Big Segments store
([#579](#579))
([fc6c075](fc6c075))
* Add C bindings for DynamoDB LazyLoad source
([#576](#576))
([65efc69](65efc69))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/cpp-server bumped from 3.12.0 to 3.13.0
</details>

<details><summary>launchdarkly-cpp-server-otel: 0.1.4</summary>

##
[0.1.4](launchdarkly-cpp-server-otel-v0.1.3...launchdarkly-cpp-server-otel-v0.1.4)
(2026-07-24)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/cpp-server bumped from 3.12.0 to 3.13.0
</details>

<details><summary>launchdarkly-cpp-server-redis-source: 2.4.0</summary>

##
[2.4.0](launchdarkly-cpp-server-redis-source-v2.3.1...launchdarkly-cpp-server-redis-source-v2.4.0)
(2026-07-24)


### Features

* Add C bindings for DynamoDB Big Segments store
([#579](#579))
([fc6c075](fc6c075))
* Add C bindings for DynamoDB LazyLoad source
([#576](#576))
([65efc69](65efc69))
* Add C bindings for Redis Big Segments store
([#574](#574))
([52a1898](52a1898))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * @launchdarkly/cpp-server bumped from 3.12.0 to 3.13.0
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Mechanical release-only edits; the notable behavioral change
(custom-event redaction) ships via internal 0.14.1 but is not modified
in this PR’s diff.
> 
> **Overview**
> Release Please **version bump** across the C++ monorepo: updates
`.release-please-manifest.json`, `package.json` workspace deps, CMake
`VERSION`, embedded `kVersion` strings, version tests, and **CHANGELOG**
entries for the packages being published.
> 
> **Server SDK 3.13.0** documents **C bindings for Big Segments**
([#573]). **Internal 0.14.1** documents a **privacy fix** that **redacts
anonymous context attributes in server-side custom events** ([#583]).
**DynamoDB source 0.3.0** and **Redis source 2.4.0** document new **C
bindings** for Big Segments stores and DynamoDB LazyLoad; **client
3.11.3** and **otel 0.1.4** are dependency-aligned releases on
**internal 0.14.1** / **server 3.13.0**.
> 
> There is **no application logic in this diff**—only release metadata
reflecting changes already on `main`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
05b4327. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants