Repository navigation
refactor(segment): split ChunkedVectors into read-only core + write wrapper - #8915
Conversation
…rapper Extract the read-side API into ChunkedVectorsRead<T, S: UniversalRead<T>> and rebuild the existing ChunkedVectors<T, S: UniversalWrite<T>> on top of it via composition + Deref. Lets read-only consumers use the storage without pulling in UniversalWrite, and avoids method duplication. Reorganizes the file into a chunked_vectors/ module: config (constants, ChunkedVectorsConfig, Status), chunks (read_chunks/create_chunk helpers), read (ChunkedVectorsRead), write (ChunkedVectors wrapper). read_chunks now takes a writeable flag so both open paths share it. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
Caution Review failedFailed to post review comments 📝 WalkthroughWalkthroughThe chunked vector storage module was refactored from a single monolithic file into a modular structure with separate concerns. The original Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ 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 |
…rapper (#8915) Extract the read-side API into ChunkedVectorsRead<T, S: UniversalRead<T>> and rebuild the existing ChunkedVectors<T, S: UniversalWrite<T>> on top of it via composition + Deref. Lets read-only consumers use the storage without pulling in UniversalWrite, and avoids method duplication. Reorganizes the file into a chunked_vectors/ module: config (constants, ChunkedVectorsConfig, Status), chunks (read_chunks/create_chunk helpers), read (ChunkedVectorsRead), write (ChunkedVectors wrapper). read_chunks now takes a writeable flag so both open paths share it. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
ChunkedVectorsRead<T, S: UniversalRead<T>>containing all read-side state (config, chunks, snapshot len, directory) and read-side API (get,iter,for_each_in_batch,files,populate,clear_cache, ...). Read-only consumers can now use the storage without anUniversalWritebound.ChunkedVectors<T, S: UniversalWrite<T>>on top via composition +Deref<Target = ChunkedVectorsRead<T, S>>. Mutating methods (insert,insert_many,push,flusher) live on the wrapper; writes update both the liveMmapType<Status>and the inner snapshot len in lockstep.chunked_vectors/module:config.rs(constants,ChunkedVectorsConfig,Status),chunks.rs(read_chunks/create_chunkhelpers),read.rs(ChunkedVectorsRead),write.rs(ChunkedVectors),mod.rs(wiring + tests).read_chunksis generalized toS: UniversalRead<T>with awriteable: boolflag so both open paths share it. Two UFCS callers inquantized_chunked_mmap_storageswitched to method-call syntax to go throughDeref.ChunkedVectorsRead::openis wired and tested but currently#[allow(dead_code)]— it's the entry point for the upcoming read-only vector storage enum.Test plan
cargo check -p segment— clean, no warningscargo test -p segment --lib vector_storage::chunked_vectors::tests::test_chunked_mmap— passes🤖 Generated with Claude Code