-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Add client support for streaming. #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
apps/hello-cpp/main.cpp
Outdated
|
|
||
| client->run(); | ||
| ioc.run(); | ||
| Client client(ConfigBuilder(key).build().value(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have not implemented data source status or checks for initialization complete, so this just starts a thread and evaluates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤑
|
|
||
| private: | ||
| std::shared_ptr<IDataSourceUpdateSink> handler_; | ||
| IDataSourceUpdateSink* handler_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to a pointer now that the ownership of the sink is in the client.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to be a reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am kind of curious if potentially we should change more of these items to be pointers. Clang tidy prefers it, but also it makes more clear when using them that they aren't values.
I am trying to see if the google style guide has any recommendations, it seems it maybe used to recommend pointers, but now doesn't seem to have either.
Anyway, going to defer for the moment.
libs/client-sdk/src/api.cpp
Outdated
| logger_)) { | ||
| data_source_->Start(); | ||
|
|
||
| // TODO: This isn't a long-term solution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need something to run tasks. This will work as a temporary approach. Just a thread chugging away at SDK tasks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is made less crashy in: #26
Still not ideal.
|
|
||
| bool Client::BoolVariation(Client::FlagKey const& key, bool default_value) { | ||
| Value Client::VariationInternal(FlagKey const& key, Value default_value) { | ||
| auto res = flag_manager_.Get(key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later this will need event sending.
| #include "console_backend.hpp" | ||
| #include "context_builder.hpp" | ||
| #include "launchdarkly/client_side/api.hpp" | ||
| #include "launchdarkly/client_side/data_sources/detail/streaming_data_source.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The duplicate header + formatting lint are probably worth doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted the headers, but my formatter doesn't seem to do anything.
apps/hello-cpp/main.cpp
Outdated
|
|
||
| client->run(); | ||
| ioc.run(); | ||
| Client client(ConfigBuilder(key).build().value(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤑
|
|
||
| private: | ||
| std::shared_ptr<IDataSourceUpdateSink> handler_; | ||
| IDataSourceUpdateSink* handler_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to be a reference?
| Value Client::VariationInternal(FlagKey const& key, Value default_value) { | ||
| auto res = flag_manager_.Get(key); | ||
| if (res && res->flag) { | ||
| return res->flag->detail().value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a plan for updating the .value() to not be unchecked (if that's an optional)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value on detail is a Value.
The linter gets annoyed with if(res->flag){flag->detail()}... but if I put .value().detail() it would be happy. Even though that isn't more checking.
No description provided.