-
Notifications
You must be signed in to change notification settings - Fork 112
[storage] support associating metadata w/ variable-store commit ops #1450
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
Conversation
321b594 to
242bfdd
Compare
242bfdd to
99c2b2e
Compare
99c2b2e to
eaea334
Compare
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.
Pull Request Overview
This PR adds support for associating arbitrary metadata with commit operations in variable-store databases. The key change is that commit operations now carry a metadata value of type V instead of being parameterless.
- Modified
CommitandCommitFlooroperation variants to include metadata parameters - Added
commit_with_metadata()methods alongside existingcommit()methods (which now use default metadata) - Added
get_metadata()methods to retrieve metadata from the last commit operation
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| storage/src/store/operation.rs | Core operation types updated to include metadata in commit variants and corresponding serialization/display logic |
| storage/src/store/mod.rs | Store implementation updated with new commit methods and metadata retrieval functionality |
| storage/src/store/benches/restart.rs | Benchmark code updated to use new commit API with metadata |
| storage/src/adb/keyless.rs | Keyless database updated to support metadata in commit operations |
| storage/src/adb/immutable/sync/mod.rs | Synchronization tests updated to use new commit API with metadata |
| storage/src/adb/immutable/mod.rs | Immutable database updated with metadata support and last commit tracking |
| storage/src/adb/any/variable/mod.rs | Variable database implementation updated with metadata commit support |
| examples/sync/src/databases/immutable.rs | Example code updated to use new commit API with metadata |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
3cccc72 to
9b0c2a5
Compare
ef8a929 to
f4278e4
Compare
24f67b0 to
3dcba93
Compare
storage/src/adb/immutable/mod.rs
Outdated
| assert_eq!(db.op_count(), 3); | ||
|
|
||
| // Make sure we can still get metadata. | ||
| assert_eq!(db.get_metadata().await.unwrap(), Some(metadata)); |
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.
Again, would be great to add a test for get on the commit op
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.
Immutable doesn't (yet) support get by location, only by key.
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.
storage/src/adb/keyless.rs
Outdated
|
|
||
| /// Get the metadata associated with the last commit, or None if no commit has been made or | ||
| /// there is no metadata associated with the last commit. | ||
| pub async fn get_metadata(&self) -> Result<Option<V>, Error> { |
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.
nit: Option<(u64, V)>
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.
I originally suggested for the other dbs but noted your comment about how it wasn't supported to fetch by position.
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.
I changed it to Option<(u64, Option<V>)>, because there is a case where there are no commit ops. That ok?
| /// Get the metadata associated with the last commit, or None if no commit has been made or | ||
| /// there is no metadata associated with the last commit. | ||
| pub async fn get_metadata(&self) -> Result<Option<V>, Error> { | ||
| pub async fn get_metadata(&self) -> Result<Option<(u64, Option<V>)>, Error> { |
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.
Ah, this makes sense
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #1450 +/- ##
==========================================
- Coverage 91.73% 91.72% -0.02%
==========================================
Files 276 276
Lines 69729 69826 +97
==========================================
+ Hits 63968 64049 +81
- Misses 5761 5777 +16
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
resolves #1447