-
Notifications
You must be signed in to change notification settings - Fork 16
[DAPS-1663] Adding LogContext to dbGetRaw #1885
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
base: devel
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,7 +54,7 @@ class AuthenticationManager : public IAuthenticationManager { | |
| *allotted purge time frame. If the count is above one then the session key | ||
| *not be purged. | ||
| **/ | ||
| virtual void incrementKeyAccessCounter(const std::string &public_key) final; | ||
| virtual void incrementKeyAccessCounter(const std::string &public_key, LogContext log_context) final; | ||
|
|
||
| /** | ||
| * This will purge all keys of a particular type that have expired. | ||
|
Comment on lines
+57
to
60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (performance): Consider passing LogContext by const reference instead of by value through the authentication APIs. All public virtual void incrementKeyAccessCounter(const std::string &public_key, const LogContext &log_context) final;
virtual bool hasKey(const std::string &pub_key, const LogContext &log_context) const final;
virtual std::string getUID(const std::string &pub_key, const LogContext &log_context) const final;
std::string getUIDSafe(const std::string &pub_key, const LogContext &log_context) const;Suggested implementation: To fully implement the suggestion, you should also:
|
||
|
|
@@ -79,15 +79,15 @@ class AuthenticationManager : public IAuthenticationManager { | |
| * - SESSION | ||
| * - PERSISTENT | ||
| **/ | ||
| virtual bool hasKey(const std::string &pub_key) const final; | ||
| virtual bool hasKey(const std::string &pub_key, LogContext log_context) const final; | ||
|
|
||
| void addKey(const PublicKeyType &pub_key_type, const std::string &public_key, | ||
| const std::string &uid); | ||
|
|
||
| /** | ||
| * Check if a specific key exists in a specific map type | ||
| **/ | ||
| bool hasKey(const PublicKeyType &pub_key_type, const std::string &public_key) const; | ||
| bool hasKey(const PublicKeyType &pub_key_type, const std::string &public_key, LogContext log_context) const; | ||
|
|
||
| /** | ||
| * Migrate a key from one type to another | ||
|
|
@@ -121,13 +121,13 @@ class AuthenticationManager : public IAuthenticationManager { | |
| * - SESSION | ||
| * - PERSISTENT | ||
| **/ | ||
| virtual std::string getUID(const std::string &pub_key) const final; | ||
| virtual std::string getUID(const std::string &pub_key, LogContext log_context) const final; | ||
|
|
||
| /** | ||
| * Safe version that returns empty string if key not found | ||
| * instead of throwing an exception | ||
| **/ | ||
| std::string getUIDSafe(const std::string &pub_key) const; | ||
| std::string getUIDSafe(const std::string &pub_key, LogContext log_context) const; | ||
| }; | ||
|
|
||
| } // namespace Core | ||
|
|
||
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.
suggestion (testing): Improve Operator/Authentication integration tests to validate LogContext usage and correlation-id generation
DummyAuthManagernow accepts aLogContext, but the tests don't verify how it's used. SinceAuthenticationOperator::executegenerates a correlation ID and passes the sameLogContexttohasKey,incrementKeyAccessCounter, andgetUID, please enhance the tests to:DummyAuthManagerstore the lastLogContextit receives, andexecute()provides a non-empty correlation ID and reuses the sameLogContextacross all three calls.This will validate the new wiring rather than just exercising the updated signature.
Suggested implementation:
To fully implement the test coverage you described, you will also need to:
Add a member field to
DummyAuthManager(in the same class wherem_countersis defined):mutable std::vector<LogContext> m_log_contexts;Make sure the header
<vector>is included if it is not already.In the relevant Operator/Authentication integration test that invokes
AuthenticationOperator::execute(...)(or usesOperatorFactoryto create the authentication operator withDummyAuthManager), add assertions such as:If
LogContextdoes not supportoperator==orcorrelation_id(), adapt the checks accordingly (for example, compare pointer identity ifLogContextis a smart pointer type, or use the appropriate getter for the correlation ID as defined incommon/DynaLog.hpp).If the same
DummyAuthManagerinstance is reused across tests, ensure you clearm_log_contexts(e.g., via aclearLogContexts()helper) between test cases or create a fresh instance per test so thatlogContexts().size()is deterministic.