Repository navigation
Add TypedStorage wrapper - #8508
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR reorganizes universal_io wrappers (making Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Propaganda piece. let bytes: Cow<[u8]> = file.read::<Sequential>()?;
file.read(ranges, |_, floats: &[f32]| {
Ok(())
}) |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as duplicate.
This comment was marked as duplicate.
ffuugoo
left a comment
There was a problem hiding this comment.
Personally, I'd not use TypedStorage if we have generic storage with a single trait bound. E.g., just use S instead of TypedStorage<S, T>. My logic is fewer wrappers/indirection is better. Like, I forgot provided impls in ReadOnly, and even with a comment it might happen again. 🤦♀️
But LGTM.
Reason: Less methods to override in wrappers. And I don't think this method makes much sense.
Implement missing methods, and follow the code style of the upcoming TypedStrorage wrapper.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/common/common/src/universal_io/wrappers/typed.rs`:
- Around line 13-26: Update the doc comment for TypedStorage to fix the typo:
change "mut" to "but" in the sentence describing when the wrapper is helpful
(the comment above the TypedStorage struct). Ensure the corrected wording
remains grammatically correct and preserves the existing explanation about
multiple UniversalRead bounds.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c47bdf51-1709-4645-b671-e12cb220ff70
📒 Files selected for processing (10)
lib/common/common/src/universal_io/file_ops.rslib/common/common/src/universal_io/io_uring.rslib/common/common/src/universal_io/mod.rslib/common/common/src/universal_io/read.rslib/common/common/src/universal_io/wrappers/mod.rslib/common/common/src/universal_io/wrappers/read_only.rslib/common/common/src/universal_io/wrappers/typed.rslib/common/common/src/universal_io/write.rslib/segment/src/vector_storage/chunked_vectors.rslib/segment/src/vector_storage/dense/immutable_dense_vectors.rs
✅ Files skipped from review due to trivial changes (4)
- lib/common/common/src/universal_io/file_ops.rs
- lib/common/common/src/universal_io/write.rs
- lib/common/common/src/universal_io/wrappers/mod.rs
- lib/common/common/src/universal_io/io_uring.rs
🚧 Files skipped from review as they are similar to previous changes (3)
- lib/common/common/src/universal_io/mod.rs
- lib/segment/src/vector_storage/dense/immutable_dense_vectors.rs
- lib/common/common/src/universal_io/wrappers/read_only.rs
* Remove UniversalRead::is_empty
Reason: Less methods to override in wrappers. And I don't think this
method makes much sense.
* Move common::universal_io::{ => wrappers}::read_only
* Update ReadOnly wrapper
Implement missing methods, and follow the code style of the upcoming
TypedStrorage wrapper.
* Add TypedStorage
* Use TypedStorage
* Add reminder comments
* Clarify TypedStorage use-case
* Remove UniversalRead::is_empty
Reason: Less methods to override in wrappers. And I don't think this
method makes much sense.
* Move common::universal_io::{ => wrappers}::read_only
* Update ReadOnly wrapper
Implement missing methods, and follow the code style of the upcoming
TypedStrorage wrapper.
* Add TypedStorage
* Use TypedStorage
* Add reminder comments
* Clarify TypedStorage use-case
This PR introduces
TypedStoragewrapper.This wrapper lets you specify the type
Tonly once in the storage type, and not on every callsite:Usually, it's not required as the Rust compiler is able to deduce the type
Tbased onwhereclauses. But it helps when there are more than one type is used within the same structure, e.g.:Unlike
MmapUniversal<T>that removed in #8493/#8505, this wrapper can work with any UIO implementation.