Implement in_memory_provider.#61
Conversation
Summary of ChangesHello @NeaguGeorgiana23, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the OpenFeature C++ SDK by introducing an Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces the InMemoryProvider and Flag<T> template class, providing a local, in-memory feature flag evaluation mechanism primarily for testing purposes. The implementation includes thread-safe operations for updating flags and handling provider status changes. The associated tests cover various scenarios, including flag evaluation, type mismatches, disabled flags, and context-based evaluation. Overall, the changes are well-structured and functional. I've identified a couple of areas where efficiency could be improved by avoiding unnecessary copies of data structures.
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
8f6be13 to
02409e6
Compare
m-olko
left a comment
There was a problem hiding this comment.
Additionally I attach manual run of clang-tidy:
./openfeature/memory_provider/in_memory_provider.h:25:3: warning: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor]
25 | InMemoryProvider(std::unordered_map<std::string, std::any> flags);
| ^
| explicit
./openfeature/memory_provider/in_memory_provider.h:27:3: warning: annotate this function with 'override' or (rarely) 'final' [modernize-use-override]
27 | ~InMemoryProvider() = default;
| ^
| override
./openfeature/memory_provider/in_memory_provider.h:56:18: warning: use default member initializer for 'status_' [modernize-use-default-member-init]
56 | ProviderStatus status_;
| ^
| {ProviderStatus::kNotReady}
./openfeature/memory_provider/in_memory_provider.cpp:76:8: warning: variable name 'it' is too short, expected at least 3 characters [readability-identifier-length]
76 | auto it = flags_.find(key_str);
| ^
|
I defer the review to @m-olko and @alichka06 |
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
Signed-off-by: NeaguGeorgiana23 <neagugeorgiana@google.com>
This PR
This PR introduces the
InMemoryProvider. This provider stores feature flags locally in memory and is primarily intended to be used for testing, allowing developers to simulate feature flag evaluations without needing an external feature management backend.Specifically, this PR:
Flag<T>template class to represent an in-memory feature flag, which supports variants, a default variant, a disabled state, metadata, and a customContextEvaluatorcallback for dynamic evaluation.InMemoryProviderclass that implements theFeatureProviderinterface.Related Issues
Fixes #57