-
Notifications
You must be signed in to change notification settings - Fork 111
[storage/index] Fix Middle Mutate Case #1155
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
/// Pushes a `Record` to the end of `past`. | ||
/// | ||
/// If the record has a `next`, this function cannot be called again. | ||
fn past_push(&mut self, mut next: Box<Record<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.
This refactored past_push
has the convenient byproduct of retaining the insertion order. I considered special casing next w/list insertion but seemed cleaner to just reduce the logic to one pattern.
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 find this simpler than the reverse list we were creating during iteration but it does use unsafe
.
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 addresses the middle mutate case in the storage index by updating the record linking logic and adjusting the test expectations accordingly.
- Updated the Cursor struct with new fields (past_tail and past_pushed_list) and refactored the past_push method to support controlled list mutation.
- Modified tests in mod.rs to reflect the new ordering of records and standardized test function naming.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
storage/src/index/storage.rs | Introduces new raw pointer field and updates past_push logic. |
storage/src/index/mod.rs | Adjusts test expectations and renames test functions uniformly. |
Comments suppressed due to low confidence (2)
storage/src/index/storage.rs:124
- Consider adding a comment within the unsafe block to document the invariants that guarantee the validity of the raw pointer 'past_tail' to assist future maintainability and safety reviews.
unsafe {
storage/src/index/mod.rs:79
- The updated expected order of elements indicates a change in the underlying logic; consider adding a note in the test documentation explaining the rationale behind the new order.
assert_eq!(index.get(key).copied().collect::<Vec<_>>(), vec![1, 4, 2]);
Ran
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
@@ Coverage Diff @@
## main #1155 +/- ##
=======================================
Coverage 91.03% 91.03%
=======================================
Files 215 215
Lines 57425 57434 +9
=======================================
+ Hits 52276 52285 +9
Misses 5149 5149
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Alternative: #1152