Repository navigation
make storage generic in ReadOnlySparseVectorStorage - #8964
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR generalizes the gridstore and segment storage layers to support pluggable storage backends via the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/gridstore/src/gridstore/reader.rs`:
- Around line 24-27: The public GridstoreReader type was changed to require an
explicit S type param which breaks existing callers; restore a default by
declaring the generic as S: UniversalRead = common::universal_io::MmapFile (i.e.
GridstoreReader<V, S: UniversalRead = MmapFile>) so the mmap-only path remains
the default, and apply the same pattern to the new public read-only wrapper
types you added (give their S generic a default to MmapFile) so downstream code
remains source-compatible.
🪄 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: 487b71ed-dedf-400d-b7e3-c1ad74f18d10
📒 Files selected for processing (7)
lib/gridstore/src/gridstore/mod.rslib/gridstore/src/gridstore/reader.rslib/gridstore/src/lib.rslib/segment/src/payload_storage/read_only/mod.rslib/segment/src/payload_storage/read_only/payload_storage_read.rslib/segment/src/vector_storage/read_only/mod.rslib/segment/src/vector_storage/sparse/read_only/sparse_vector_storage.rs
| pub struct GridstoreReader<V, S: UniversalRead> { | ||
| pub(super) config: StorageConfig, | ||
| pub(super) tracker: Tracker, | ||
| pub(super) pages: Pages<MmapFile>, | ||
| pub(super) tracker: Tracker<S>, | ||
| pub(super) pages: Pages<S>, |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Keep the mmap default on the public reader type.
GridstoreReader is publicly exposed, so adding S here turns the existing mmap-only path into a source break for downstream callers and forces them to import common::universal_io::MmapFile. Giving S a default keeps the new flexibility without making the common case noisier. The same pattern is worth mirroring on the public read-only wrappers added in this PR.
Compatibility shim
-use common::universal_io::{UniversalRead, read_json_via};
+use common::universal_io::{MmapFile, UniversalRead, read_json_via};
...
-#[derive(Debug)]
-pub struct GridstoreReader<V, S: UniversalRead> {
+#[derive(Debug)]
+pub struct GridstoreReader<V, S: UniversalRead = MmapFile> {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| pub struct GridstoreReader<V, S: UniversalRead> { | |
| pub(super) config: StorageConfig, | |
| pub(super) tracker: Tracker, | |
| pub(super) pages: Pages<MmapFile>, | |
| pub(super) tracker: Tracker<S>, | |
| pub(super) pages: Pages<S>, | |
| pub struct GridstoreReader<V, S: UniversalRead = MmapFile> { | |
| pub(super) config: StorageConfig, | |
| pub(super) tracker: Tracker<S>, | |
| pub(super) pages: Pages<S>, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@lib/gridstore/src/gridstore/reader.rs` around lines 24 - 27, The public
GridstoreReader type was changed to require an explicit S type param which
breaks existing callers; restore a default by declaring the generic as S:
UniversalRead = common::universal_io::MmapFile (i.e. GridstoreReader<V, S:
UniversalRead = MmapFile>) so the mmap-only path remains the default, and apply
the same pattern to the new public read-only wrapper types you added (give their
S generic a default to MmapFile) so downstream code remains source-compatible.
* make storage generic in ReadOnlySparseVectorStorage * fix tests
No description provided.