-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add DynamoDBHistoryAutoIncrement class for version control in DynamoDB #20
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #20 +/- ##
===========================================
+ Coverage 92.59% 100.00% +7.40%
===========================================
Files 1 1
Lines 27 39 +12
Branches 3 5 +2
===========================================
+ Hits 25 39 +14
+ Misses 1 0 -1
+ Partials 1 0 -1
☔ View full report in Codecov by Sentry. |
This is nasa-gcn#20 as a one-liner.
This is nasa-gcn#20 as a one-liner.
@dakota002, I've come around to your original idea. It has many advantages over mine:
However it does add a bunch of conditional logic, which is a hint that we should be pulling out the common logic and reusing it in two new classes. I am going to propose a couple refactorings in separate PRs that will make this more elegant. |
This makes it easier to create different autoincrement variations with the same optimistic locking loop (e.g. nasa-gcn#20).
This makes it easier to create different autoincrement variations with the same optimistic locking loop (e.g. nasa-gcn#20).
This makes it easier to create different autoincrement variations with the same optimistic locking loop (e.g. #20).
In practice, the version or counter attribute has the same name in both tables. Forcing that to be the case will make it simpler to implement versioning (nasa-gcn#20).
At this point, @dakota002, please implement your original versioning algorithm, but by subclassing the base class. |
Rewriting Remove console.log
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.
What I'm looking for is a new class that extends BaseDynamoDBAutoIncrement
and implements the next
method. You shouldn't need to modify the existing DynamoDBAutoIncrement
class, and you shouldn't need to add a flag to the props.
Sounds good! |
Co-authored-by: Leo Singer <[email protected]>
Co-authored-by: Leo Singer <[email protected]>
Co-authored-by: Leo Singer <[email protected]>
Co-authored-by: Leo Singer <[email protected]>
Co-authored-by: Leo Singer <[email protected]>
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.
- Please add a unit test that is analogous to
correctly handles a large number of parallel puts
, that tests that the locking is working correctly.
Co-authored-by: Leo Singer <[email protected]>
Co-authored-by: Leo Singer <[email protected]>
Co-authored-by: Leo Singer <[email protected]>
This replaces #16 and #17