VirtualStorageProvider: Make new() private, add new_physical#764
VirtualStorageProvider: Make new() private, add new_physical#764
Conversation
Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
…new() doc(hidden) Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
…_memory() in diskann-providers Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
…ic constructors, add clippy rule Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #764 +/- ##
==========================================
+ Coverage 88.98% 88.99% +0.01%
==========================================
Files 428 428
Lines 78365 78420 +55
==========================================
+ Hits 69730 69788 +58
+ Misses 8635 8632 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR tightens the diskann_providers::storage::VirtualStorageProvider API by making the generic new() constructor private and pushing callers toward explicit constructors (new_memory, new_overlay, new_physical) that better communicate intent and reduce accidental real-filesystem usage in tests.
Changes:
- Made
VirtualStorageProvider::new()fully private and updated call sites to use intent-specific constructors. - Added
VirtualStorageProvider::new_physical(...)for sandboxed physical filesystem usage. - Added a Clippy
disallowed-methodsrule to discouragenew_physical()in tests and updated examples/bench code accordingly.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| diskann-tools/src/utils/relative_contrast.rs | Switched tests from VirtualStorageProvider::new(MemoryFS) to new_memory(). |
| diskann-tools/src/utils/build_disk_index.rs | Switched tests to VirtualStorageProvider::new_memory(). |
| diskann-providers/src/utils/storage_utils.rs | Updated tests to use new_memory() instead of constructing MemoryFS directly. |
| diskann-providers/src/utils/sampling.rs | Updated tests to use new_memory(). |
| diskann-providers/src/utils/medoid.rs | Updated tests to use new_memory() and write via storage_provider.filesystem(). |
| diskann-providers/src/utils/file_util.rs | Updated tests to use new_memory(). |
| diskann-providers/src/storage/virtual_storage_provider.rs | Made new() private, added new_physical(), updated doctest examples and unit tests. |
| diskann-providers/src/storage/sq_storage.rs | Updated tests to use new_memory(). |
| diskann-providers/src/storage/protos/storage.rs | Updated tests to use new_memory(). |
| diskann-providers/src/storage/pq_storage.rs | Updated tests to use new_memory(). |
| diskann-providers/src/storage/index_storage.rs | Updated async test to use new_memory(). |
| diskann-providers/src/model/pq/pq_construction.rs | Updated tests to use new_memory(). |
| diskann-providers/src/model/graph/provider/async_/simple_neighbor_provider.rs | Updated tests to use new_memory(). |
| diskann-providers/src/model/graph/provider/async_/memory_vector_provider.rs | Updated tests to use new_memory(). |
| diskann-providers/src/model/graph/provider/async_/memory_quant_vector_provider.rs | Updated tests to use new_memory(). |
| diskann-providers/src/model/graph/provider/async_/inmem/scalar.rs | Updated tests to use new_memory(). |
| diskann-providers/src/model/graph/provider/async_/fast_memory_vector_provider.rs | Updated tests to use new_memory(). |
| diskann-providers/src/model/graph/provider/async_/fast_memory_quant_vector_provider.rs | Updated tests to use new_memory(). |
| diskann-providers/benches/benchmarks_iai/copy_aligned_data_bench_iai.rs | Updated benchmark setup to use new_physical(...). |
| diskann-providers/benches/benchmarks/copy_aligned_data_bench.rs | Updated benchmark setup to use new_physical(...). |
| diskann-disk/src/storage/quant/pq/pq_generation.rs | Simplified test storage setup to new_memory() and generalized helper types. |
| diskann-disk/src/storage/quant/generator.rs | Updated test helpers to use new_memory() and generalized storage provider type params. |
| diskann-disk/src/storage/cached_reader.rs | Updated tests to use new_memory(). |
| diskann-disk/src/build/builder/build.rs | Updated tests to use new_memory(). |
| clippy.toml | Added disallowed-methods entry for VirtualStorageProvider::new_physical. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…xamples, remove unnecessary turbofish Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
## What's Changed ### API Breaking Changes * Remove the `experimental_avx512` feature. by @hildebrandmw in #732 * Use VirtualStorageProvider::new_overlay(test_data_root()) in tests by @Copilot in #726 * save and load max_record_size and leaf_page_size for bftrees by @backurs in #724 * [multi-vector] Verify `Standard` won't overflow in its constructor. by @hildebrandmw in #757 * VirtualStorageProvider: Make new() private, add new_physical by @Copilot in #764 * [minmax] Refactor full query by @arkrishn94 in #770 * Bump diskann-quantization to edition 2024. by @hildebrandmw in #772 ### Additions * [multi-vector] Enable cloning of `Mat` and friends. by @hildebrandmw in #759 * adding bftreepaths in mod.rs by @backurs in #775 * [quantization] Add `as_raw_ptr`. by @hildebrandmw in #774 ### Bug Fixes * Fix `diskann` compilation without default-features and add CI tests. by @hildebrandmw in #722 ### Docs and Comments * Updating the benchmark README to use diskann-benchmark by @bryantower in #709 * Fix doc comment: Windows line endings are \r\n not \n\r by @Copilot in #717 * Fix spelling errors in streaming API documentation by @Copilot in #715 * Add performance diagnostic to `diskann-benchmark` by @hildebrandmw in #744 * Add agents.md onboarding guide for coding agents by @Copilot in #765 * [doc] Fix lots of little typos in `diskann-wide` by @hildebrandmw in #771 ### Performance * [diskann-wide] Optimize `load_simd_first` for 8-bit and 16-bit element types. by @hildebrandmw in #747 ### Dependencies * Bump bytes from 1.11.0 to 1.11.1 by @dependabot[bot] in #723 * [diskann] Add note on the selection of `PruneKind` in `graph::config::Builder`. by @hildebrandmw in #734 * [diskann-providers] Remove the LRU dependency and make `vfs` and `serde_json` optional. by @hildebrandmw in #733 ### Infrastructure * Add initial QEMU tests for `diskann-wide`. by @hildebrandmw in #719 * [CI] Skip coverage for Dependabot. by @hildebrandmw in #725 * Add miri test coverage to CI workflow by @Copilot in #729 * [CI] Add minimal ARM checks by @hildebrandmw in #745 * Enable CodeQL security analysis by @Copilot in #754 ## New Contributors * @backurs made their first contribution in #724 * @arkrishn94 made their first contribution in #770 **Full Changelog**: 0.45.0...0.46.0
Completed Changes
VirtualStorageProvider::new()fully private (not just doc-hidden)new_memory()VirtualStorageProvider::new_physicalto clippy.toml disallowed-methods listuse std::io::Write;import to doc examplesnew_memory()usageAll PR review feedback has been addressed.
Original prompt
new_overlayornew_memory#703💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.