Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contract-tests/client-contract-tests/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int main(int argc, char* argv[]) {
srv.add_capability("context-type");
srv.add_capability("service-endpoints");
srv.add_capability("tags");
srv.add_capability("inline-context");

net::signal_set signals{ioc, SIGINT, SIGTERM};

Expand Down
1 change: 1 addition & 0 deletions contract-tests/server-contract-tests/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int main(int argc, char* argv[]) {
srv.add_capability("service-endpoints");
srv.add_capability("tags");
srv.add_capability("server-side-polling");
srv.add_capability("inline-context");

net::signal_set signals{ioc, SIGINT, SIGTERM};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct FeatureEventBase {

struct FeatureEvent {
FeatureEventBase base;
ContextKeys context_keys;
EventContext context;
};

struct DebugEvent {
Expand Down
4 changes: 2 additions & 2 deletions libs/internal/src/events/asio_event_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ std::vector<OutputEvent> AsioEventProcessor<SDK>::Process(
}

if (event.require_full_event) {
out.emplace_back(FeatureEvent{std::move(base),
event.context.KindsToKeys()});
Copy link
Contributor

Choose a reason for hiding this comment

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

To fix the formatting errors, you can run clang format (maybe part of clang package on Arch?)

out.emplace_back(FeatureEvent{
std::move(base), filter_.filter(event.context)});
}
},
[&](IdentifyEventParams&& event) {
Expand Down
3 changes: 1 addition & 2 deletions libs/internal/src/serialization/events/json_events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ void tag_invoke(boost::json::value_from_tag const& tag,
FeatureEvent const& event) {
auto base = boost::json::value_from<FeatureEventBase const&>(event.base);
base.as_object().emplace("kind", "feature");
base.as_object().emplace("contextKeys",
boost::json::value_from(event.context_keys));
base.as_object().emplace("context", boost::json::value_from(event.context));
json_value = std::move(base);
}

Expand Down
7 changes: 5 additions & 2 deletions libs/internal/tests/event_serialization_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace launchdarkly::events {

TEST(EventSerialization, FeatureEvent) {
auto creation_date = std::chrono::system_clock::from_time_t({});
AttributeReference::SetType attrs;
ContextFilter filter(false, attrs);
auto context = ContextBuilder().Kind("foo", "bar").Build();
auto event = events::FeatureEvent{
events::FeatureEventBase(events::FeatureEventParams{
creation_date,
Expand All @@ -25,12 +28,12 @@ TEST(EventSerialization, FeatureEvent) {
std::nullopt,

}),
std::map<std::string, std::string>{{"foo", "bar"}}};
filter.filter(context)};

auto event_json = boost::json::value_from(event);

auto result = boost::json::parse(
R"({"creationDate":0,"key":"key","version":1,"variation":2,"value":4.2E1,"default":3E0,"kind":"feature","contextKeys":{"foo":"bar"}})");
R"({"creationDate":0,"key":"key","version":1,"variation":2,"value":4.2E1,"default":3E0,"kind":"feature","context":{"key":"bar","kind":"foo"}})");

ASSERT_EQ(result, event_json);
}
Expand Down