Skip to content

feat: Add C bindings for DynamoDB LazyLoad source#576

Open
beekld wants to merge 1 commit into
beeklimt/SDK-2628/redis-big-segments-c-bindingfrom
beeklimt/SDK-2629/dynamodb-lazyload-c-binding
Open

feat: Add C bindings for DynamoDB LazyLoad source#576
beekld wants to merge 1 commit into
beeklimt/SDK-2628/redis-big-segments-c-bindingfrom
beeklimt/SDK-2629/dynamodb-lazyload-c-binding

Conversation

@beekld

@beekld beekld commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Introduces DynamoDB C bindings. Before this PR, none of the DynamoDB integration was reachable from C -- neither LazyLoad source nor Big Segments store. This PR covers the LazyLoad source and the shared DynamoDBClientOptions surface; the Big Segments store follow-on will reuse the options builder introduced here.

New public surface:

  • LDServerDynamoDBClientOptionsBuilder opaque handle for AWS DynamoDB client configuration.
  • LDServerDynamoDBClientOptionsBuilder_New / _Free, and setters for _Region, _Endpoint, _AccessKeyId, _SecretAccessKey, _SessionToken.
  • LDServerLazyLoadDynamoDBSource opaque handle.
  • struct LDServerLazyLoadDynamoDBResult with source and error_message fields, plus LDSERVER_LAZYLOAD_DYNAMODBSOURCE_ERROR_MESSAGE_SIZE.
  • LDServerLazyLoadDynamoDBSource_New(table_name, prefix, options, out_result) factory and LDServerLazyLoadDynamoDBSource_Free(source).

Tests:

  • Unit tests for the options builder (create, set every field, free).
  • Unit tests for successful source creation with and without the options builder (NULL means "AWS SDK default provider chain").
  • End-to-end test against DynamoDB Local: creates a table, writes flags through the existing PrefixedDynamoDBClient fixture, wires the source through the C API, and verifies LDServerSDK_AllFlagsState reads the flags back. Mirrors the Redis LazyLoad e2e.

Design decisions worth flagging: the source type name uses config-section-first word order (LazyLoad + DynamoDB + Source) to match the existing Redis LazyLoad binding LDServerLazyLoadRedisSource. The client options type is named LDServerDynamoDBClientOptionsBuilder (with Builder suffix) even though the C++ side is a plain struct rather than a builder -- the C surface is builder-like from the caller's perspective (_New + setters + consumed by a factory), which matches the sibling LDServerHttpPropertiesTlsBuilder precedent in the same shape.

Stacked on #574 (Redis Big Segments store). Please review that PR first.


Note

Medium Risk
New public C surface and AWS client credential configuration; behavior is read-only against Relay-populated tables but misconfiguration could affect flag loading in production.

Overview
Exposes the DynamoDB Lazy Load data source to C callers, matching the existing Redis LazyLoad binding pattern (LDServerLazyLoadRedisSource).

New C API: LDServerDynamoDBClientOptionsBuilder (region, endpoint, static/session credentials; unset fields use the AWS SDK default chain) and LDServerLazyLoadDynamoDBSource via LDServerLazyLoadDynamoDBSource_New(table, prefix, options, &result) with stack-allocated LDServerLazyLoadDynamoDBResult for success or a fixed-size error_message. Factories consume the options builder; callers free the source only if they do not hand it to LDServerLazyLoadBuilder_SourcePtr.

Implementation: Thin C shims in bindings/dynamodb/ delegate to DynamoDBDataSource::Create and DynamoDBClientOptions; CMake wires the new translation units into server-sdk-dynamodb-source.

Tests: Options builder lifecycle, source creation with options and with NULL options, plus a DynamoDB Local e2e that configures LazyLoad through the C API and asserts LDServerSDK_AllFlagsState reads seeded flags.

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

@beekld beekld force-pushed the beeklimt/SDK-2628/redis-big-segments-c-binding branch from 2ce9c92 to e06f24a Compare July 1, 2026 19:06
@beekld beekld force-pushed the beeklimt/SDK-2629/dynamodb-lazyload-c-binding branch from b4c4558 to 00c3ce9 Compare July 1, 2026 19:09
@beekld beekld force-pushed the beeklimt/SDK-2628/redis-big-segments-c-binding branch from e06f24a to c0acca8 Compare July 1, 2026 23:45
@beekld beekld force-pushed the beeklimt/SDK-2629/dynamodb-lazyload-c-binding branch from 00c3ce9 to d4251b7 Compare July 1, 2026 23:46
@beekld beekld marked this pull request as ready for review July 2, 2026 00:09
@beekld beekld requested a review from a team as a code owner July 2, 2026 00:09
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