Skip to content

Conversation

@cwaldren-ld
Copy link
Contributor

@cwaldren-ld cwaldren-ld commented Nov 16, 2023

This implements a Redis data source for the server-side SDK.

When using this source, the SDK operates in what was previously known as "daemon mode". It treats Redis as read-only, loading data on-demand into an in-memory cache.

There is no connection to LaunchDarkly when using a Redis data source. That'll come later, when Redis will be able to be used as a destination.

cwaldren-ld and others added 30 commits August 24, 2023 11:41
Fixes handling of undefined variations in VariationOrRollout structures.
Previously, the lack of a variation was treated as 0.

Instead, there is a special case that variation must be defined or
else a flag is malformed.
This significantly refactors the `Variation` internal calls to be much
easier to reason about. In the process, it fixes some broken behavior
which is now reflected in the suppressions list.

It also refactors event generation to use the
`EventScope`/`EventFactory` pattern found in other SDKs, such as Rust
and Go.
This removes a bunch of duplicated work from the top-level typed
Variation methods, and pushes it into the internal `Variation` method.
We had an infinite loop where the `Value` tag invoke deserializer was
calling the `tl::expected<Value, JsonError` version, which called back
to itself.

This was manifesting as a runtime infinite loop. 

It's not caught by contract tests since I believe the trigger is having
a list of variations that are themselves arrays, like:
```
"variations": [["a","b","c",123,true,"false"], [ .. other stuff ..], ... ]
```
The fix is to break the cycle and remove the incorrect implementation.
This moves all the `_ErrorInfo_` C bindings out of the client-side SDK
and into the common library, allowing them to be shared with the server.

This should be backwards compatible because the `sdk.h` includes the new
`error_info.h`, providing the same symbols as before.
Adds a new README for the server. 

Also adds a link from the client-side README to this one.

---------

Co-authored-by: Molly <molly.jones@launchdarkly.com>
I hadn't wired up the `DataStoreUpdater` component, so we were just
inserting flag updates directly in the memory store.

With this in place, we can remove the streaming update suppression.
Implements a set of C bindings for the server-side SDK. 

Missing are flag notifier bindings, but this isn't implemented in the
C++ side yet either.
Hooks up the initial reconnect delay parameter to the server-side
streaming data source. Allows us to remove another batch of contract
test failures.
The argument to `ValidChar` is a `char`, so its max value is `255`
rendering the check redundant. This causes a warning on our Mac
compilations as well as a linter warning.

---------

Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
# ./scripts/build-release launchdarkly-cpp-client

set -e

Copy link
Contributor Author

@cwaldren-ld cwaldren-ld Dec 1, 2023

Choose a reason for hiding this comment

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

This is more a general issue that we build targets independently, but we require the full cmake configuration step to do so.

Might make sense to go further down this path and add LD_BUILD_SERVER and LD_BUILD_CLIENT so we can speed up CI / disable unnecessary work for people who don't want it.

auto result =
boost::json::value_to<tl::expected<std::optional<Item>, JsonError>>(
json_val);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: make an actual tag_invoke deserializer for this.

@cwaldren-ld cwaldren-ld force-pushed the cw/sc-224112/redis-client branch from 4d0283e to 2c28a45 Compare December 2, 2023 00:07
@cwaldren-ld cwaldren-ld marked this pull request as ready for review December 4, 2023 18:52
@cwaldren-ld cwaldren-ld requested a review from a team December 4, 2023 18:52
@cwaldren-ld cwaldren-ld merged commit e5268d2 into feat/data-system Dec 4, 2023
@cwaldren-ld cwaldren-ld deleted the cw/sc-224112/redis-client branch December 4, 2023 20:11
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.

3 participants