Introduce new createOrReplaceAndReturn/bulkCreateOrReplaceAndReturn APIs with WriteAndReturnOptions in Collection#309
Open
suddendust wants to merge 5 commits into
Open
Introduce new createOrReplaceAndReturn/bulkCreateOrReplaceAndReturn APIs with WriteAndReturnOptions in Collection#309suddendust wants to merge 5 commits into
suddendust wants to merge 5 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #309 +/- ##
============================================
- Coverage 81.63% 81.45% -0.19%
Complexity 1549 1549
============================================
Files 242 245 +3
Lines 7450 7467 +17
Branches 720 720
============================================
Hits 6082 6082
- Misses 916 933 +17
Partials 452 452
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces two new methods in
Collection.java:Collection#createOrReplaceAndReturn(final Key key, final Document document, final WriteAndReturnOptions options)Collection#ulkCreateOrReplaceAndReturn(Map<Key, Document> documents, WriteAndReturnOptions options)The idea behind these methods is to return the before/after docs to the client in a single-shot rather the client requesting before/after docs by itself (which requires more round-trips to the DB). We do something similar with
UpdateOptions.Testing
N/A: This PR just adds these methods to the contract, so not testing is needed yet.
Checklist:
Documentation
The user can also control if we wants the operation to be atomic using
atomicparameters inWriteAndReturnOptions. If set totrue, then the before/after view are returned atomically, ensuring no intertwining of concurrent requests.