-
Notifications
You must be signed in to change notification settings - Fork 46
feat: Added hook data #1506
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: main
Are you sure you want to change the base?
feat: Added hook data #1506
Conversation
* Default thread-safe implementation of HookData. | ||
*/ | ||
public class DefaultHookData implements HookData { | ||
private final Map<String, Object> data = Collections.synchronizedMap(new HashMap<>()); |
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.
Do we need a thread safe implementation? If the hook data only lives for the duraion of a flag evalution, there will probably not be concurrent access to this object. IIRC, a flag evaluation happens synchronously.
<T> T get(String key, Class<T> type); | ||
|
||
/** | ||
* Default implementation using ConcurrentHashMap for thread safety. |
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.
DefaultHookData
uses a Collections.synchronizedMap(new HashMap<>())
, not a ConcurrentHashMap
* Hook data provides a way for hooks to maintain state across their execution stages. | ||
* Each hook instance gets its own isolated data store. | ||
*/ | ||
HookData hookData; |
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.
With this addition, the Constructor of the HookContext
changes, which may be a breaking change @toddbaert
@mdxabu you will need to force push a commit that is signed off, otherwise the DCO check will not succeed |
Can I squash those commits into one commit, and then I will sign off? |
Yes, you could do that. If you click on the failed DCO action, you schould see a short explanation |
Signed-off-by: mdxabu <[email protected]>
…d ConcurrentHashMap and use a synchronized HashMap instead Signed-off-by: mdxabu <[email protected]>
@chrfwow, I force push the commits! Now DCO action runs successfully. |
The build currently fails because of formatting issues. You can resolve them automatically by running the spotless plugin |
Signed-off-by: mdxabu <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1506 +/- ##
============================================
+ Coverage 92.81% 93.35% +0.53%
- Complexity 486 491 +5
============================================
Files 46 47 +1
Lines 1169 1188 +19
Branches 103 107 +4
============================================
+ Hits 1085 1109 +24
+ Misses 54 49 -5
Partials 30 30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This PR
Added the Hook Data
Related Issues
Fixes #1472
@beeme1mr, Please review this if there is any problem or if I did anything wrong, ping me!