Skip to content

Commit 1c06409

Browse files
committed
Merge branch 'main' into devin/1774991616-immutable-releases
2 parents 2e85850 + b741911 commit 1c06409

16 files changed

Lines changed: 465 additions & 19 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ build-dynamic
4242
build-static-debug
4343
build-dynamic-debug
4444
cmake-build-*
45+
.cache
4546

4647
# For Macs..
4748
.DS_Store

libs/client-sdk/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "launchdarkly-cpp-client",
2+
"name": "@launchdarkly/cpp-client",
33
"description": "This package.json exists for modeling dependencies for the release process.",
44
"version": "3.11.1",
55
"private": true,
66
"dependencies": {
7-
"launchdarkly-cpp-internal": "0.13.0",
8-
"launchdarkly-cpp-common": "1.11.0",
9-
"launchdarkly-cpp-sse-client": "0.6.1"
7+
"@launchdarkly/cpp-internal": "0.13.0",
8+
"@launchdarkly/cpp-common": "1.11.0",
9+
"@launchdarkly/cpp-sse-client": "0.6.1"
1010
}
1111
}

libs/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "launchdarkly-cpp-common",
2+
"name": "@launchdarkly/cpp-common",
33
"description": "This package.json exists for modeling dependencies for the release process.",
44
"version": "1.11.0",
55
"private": true

libs/internal/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "launchdarkly-cpp-internal",
2+
"name": "@launchdarkly/cpp-internal",
33
"description": "This package.json exists for modeling dependencies for the release process.",
44
"version": "0.13.0",
55
"private": true,
66
"dependencies": {
7-
"launchdarkly-cpp-common": "1.11.0",
8-
"launchdarkly-cpp-networking": "0.2.0"
7+
"@launchdarkly/cpp-common": "1.11.0",
8+
"@launchdarkly/cpp-networking": "0.2.0"
99
}
1010
}

libs/networking/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "launchdarkly-cpp-networking",
2+
"name": "@launchdarkly/cpp-networking",
33
"description": "This package.json exists for modeling dependencies for the release process.",
44
"version": "0.2.0",
55
"private": true

libs/server-sdk-otel/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "launchdarkly-cpp-server-otel",
2+
"name": "@launchdarkly/cpp-server-otel",
33
"description": "This package.json exists for modeling dependencies for the release process.",
44
"version": "0.1.1",
55
"private": true,
66
"dependencies": {
7-
"launchdarkly-cpp-server": "3.10.1"
7+
"@launchdarkly/cpp-server": "3.10.1"
88
}
99
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "launchdarkly-cpp-server-redis-source",
2+
"name": "@launchdarkly/cpp-server-redis-source",
33
"description": "This package.json exists for modeling dependencies for the release process.",
44
"version": "2.2.2",
55
"private": true,
66
"dependencies": {
7-
"launchdarkly-cpp-server": "3.10.1"
7+
"@launchdarkly/cpp-server": "3.10.1"
88
}
99
}

libs/server-sdk/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "launchdarkly-cpp-server",
2+
"name": "@launchdarkly/cpp-server",
33
"description": "This package.json exists for modeling dependencies for the release process.",
44
"version": "3.10.1",
55
"private": true,
66
"dependencies": {
7-
"launchdarkly-cpp-internal": "0.13.0",
8-
"launchdarkly-cpp-common": "1.11.0",
9-
"launchdarkly-cpp-sse-client": "0.6.1"
7+
"@launchdarkly/cpp-internal": "0.13.0",
8+
"@launchdarkly/cpp-common": "1.11.0",
9+
"@launchdarkly/cpp-sse-client": "0.6.1"
1010
}
1111
}

libs/server-sdk/src/data_components/memory_store/memory_store.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "memory_store.hpp"
22

3+
#include <launchdarkly/detail/unreachable.hpp>
4+
35
namespace launchdarkly::server_side::data_components {
46

57
std::shared_ptr<data_model::FlagDescriptor> MemoryStore::GetFlag(
@@ -82,4 +84,34 @@ bool MemoryStore::RemoveSegment(std::string const& key) {
8284
return segments_.erase(key) == 1;
8385
}
8486

87+
void MemoryStore::Apply(data_model::FDv2ChangeSet changeSet) {
88+
std::lock_guard lock{data_mutex_};
89+
90+
switch (changeSet.type) {
91+
case data_model::FDv2ChangeSet::Type::kNone:
92+
return;
93+
case data_model::FDv2ChangeSet::Type::kPartial:
94+
break;
95+
case data_model::FDv2ChangeSet::Type::kFull:
96+
initialized_ = true;
97+
flags_.clear();
98+
segments_.clear();
99+
break;
100+
default:
101+
detail::unreachable();
102+
}
103+
104+
for (auto& change : changeSet.changes) {
105+
if (std::holds_alternative<data_model::FlagDescriptor>(change.object)) {
106+
flags_[change.key] = std::make_shared<data_model::FlagDescriptor>(
107+
std::move(std::get<data_model::FlagDescriptor>(change.object)));
108+
} else if (std::holds_alternative<data_model::SegmentDescriptor>(
109+
change.object)) {
110+
segments_[change.key] =
111+
std::make_shared<data_model::SegmentDescriptor>(std::move(
112+
std::get<data_model::SegmentDescriptor>(change.object)));
113+
}
114+
}
115+
}
116+
85117
} // namespace launchdarkly::server_side::data_components

libs/server-sdk/src/data_components/memory_store/memory_store.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "../../data_interfaces/destination/idestination.hpp"
44
#include "../../data_interfaces/store/istore.hpp"
55

6+
#include <launchdarkly/data_model/fdv2_change.hpp>
7+
68
#include <memory>
79
#include <mutex>
810
#include <string>
@@ -44,6 +46,8 @@ class MemoryStore final : public data_interfaces::IStore,
4446

4547
bool RemoveSegment(std::string const& key);
4648

49+
void Apply(data_model::FDv2ChangeSet changeSet);
50+
4751
MemoryStore() = default;
4852
~MemoryStore() override = default;
4953

0 commit comments

Comments
 (0)