-
Notifications
You must be signed in to change notification settings - Fork 114
[storage/store] change variable stores to use varint for uint64 wrapping operations #1449
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
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 changes variable stores to use varint encoding for uint64 values in commit floor operations, replacing fixed-length encoding to save space when storing smaller values.
- Replaces
u64withUInt<u64>wrapper for commit floor operations - Updates serialization/deserialization to use varint encoding instead of fixed-length bytes
- Modifies display formatting to handle the wrapped type
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| storage/src/store/operation.rs | Changes CommitFloor variant to use UInt<u64> wrapper and updates encoding/decoding logic |
| storage/src/store/mod.rs | Updates code to wrap u64 values in UInt when creating CommitFloor operations |
| storage/src/adb/any/variable/mod.rs | Updates code to wrap u64 values in UInt when creating CommitFloor operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
cc765f6 to
cfce8c4
Compare
cfce8c4 to
91404e1
Compare
storage/src/store/operation.rs
Outdated
| COMMIT_FLOOR_CONTEXT => { | ||
| let floor_loc = u64::read(buf)?; | ||
| Ok(Self::CommitFloor(floor_loc)) | ||
| let floor_loc = UInt::<u64>::read(buf)?; |
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.
We can infer the type here:
| let round = UInt::read(buf)?.into(); |
You should just be able to do Uint::read(buf)?.into();
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.
done
| match &self { | ||
| Fixed::Delete(k) => { | ||
| buf.put_u8(DELETE_CONTEXT); | ||
| DELETE_CONTEXT.write(buf); |
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.
❤️
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1449 +/- ##
=======================================
Coverage 91.73% 91.73%
=======================================
Files 276 276
Lines 69729 69729
=======================================
Hits 63968 63968
Misses 5761 5761
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Since there's no need to maintain a fixed length, use of varint should in general save space.