Commit 0a00171
VirtualStorageProvider: Make new() private, add new_physical (#764)
## Completed Changes
- [x] Made `VirtualStorageProvider::new()` fully private (not just
doc-hidden)
- [x] Updated all unit tests in virtual_storage_provider.rs to use
`new_memory()`
- [x] Updated all usages across diskann-providers, diskann-disk, and
diskann-tools to use specific constructors
- [x] Added `VirtualStorageProvider::new_physical` to clippy.toml
disallowed-methods list
- [x] Removed all unused imports (MemoryFS, OverlayFS)
- [x] Made test helper functions generic over filesystem type where
needed
- [x] **Fixed doc tests:**
- Added missing `use std::io::Write;` import to doc examples
- Removed doc examples that write to physical filesystem (new_physical
and new_overlay)
- Simplified to only show `new_memory()` usage
- Removed unnecessary turbofish notation in test code
- [x] Verified all checks pass:
- ✅ cargo fmt --all --check
- ✅ cargo clippy --locked --workspace --all-targets --no-deps
- ✅ cargo test --doc --workspace
- ✅ All unit tests pass
All PR review feedback has been addressed.
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>VirtualStorageProvider: encourage use of `new_overlay` or
`new_memory`</issue_title>
> <issue_description>Make `VirtualStorageProvider::new` private.
> Also add VirtualStorageProvider<PhysicalFS>::new_physical<P:
AsRef<std::path::Path>>(path: P).
> Expose only new_overlay(), new_memory(), new_physical().
>
> Examples like these should be replaced with
VirtualStorageProvider::new_memory():
> let fs = OverlayFS::new(&[MemoryFS::default().into()]);
> let storage_provider = VirtualStorageProvider::new(fs);
>
> Original post:
> > Do you see any value in making `VirtualStorageProvider::new` much
harder to call to encourage use of `new_overlay` or `new_memory`? Maybe
with like a `new_physical` and then linting that with clippy?
>
> _Originally posted by @hildebrandmw in
[#700](https://github.com/microsoft/DiskANN/pull/700/changes#r2722436904)_</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes #703
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: arrayka <1551741+arrayka@users.noreply.github.com>
Co-authored-by: arrayka <arrayka@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 456c94a commit 0a00171
25 files changed
Lines changed: 134 additions & 190 deletions
File tree
- diskann-disk/src
- build/builder
- storage
- quant
- pq
- diskann-providers
- benches
- benchmarks_iai
- benchmarks
- src
- model
- graph/provider/async_
- inmem
- pq
- storage
- protos
- utils
- diskann-tools/src/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
916 | 916 | | |
917 | 917 | | |
918 | 918 | | |
919 | | - | |
920 | 919 | | |
921 | 920 | | |
922 | 921 | | |
| |||
930 | 929 | | |
931 | 930 | | |
932 | 931 | | |
933 | | - | |
934 | | - | |
| 932 | + | |
935 | 933 | | |
936 | 934 | | |
937 | 935 | | |
| |||
945 | 943 | | |
946 | 944 | | |
947 | 945 | | |
948 | | - | |
| 946 | + | |
949 | 947 | | |
950 | 948 | | |
951 | 949 | | |
| |||
956 | 954 | | |
957 | 955 | | |
958 | 956 | | |
959 | | - | |
960 | | - | |
| 957 | + | |
961 | 958 | | |
962 | 959 | | |
963 | 960 | | |
| |||
972 | 969 | | |
973 | 970 | | |
974 | 971 | | |
975 | | - | |
976 | | - | |
| 972 | + | |
977 | 973 | | |
978 | 974 | | |
979 | 975 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
| 133 | + | |
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
| |||
190 | 189 | | |
191 | 190 | | |
192 | 191 | | |
193 | | - | |
194 | | - | |
| 192 | + | |
195 | 193 | | |
196 | 194 | | |
197 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
376 | | - | |
377 | | - | |
378 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
379 | 381 | | |
380 | | - | |
381 | 382 | | |
382 | 383 | | |
383 | 384 | | |
| |||
411 | 412 | | |
412 | 413 | | |
413 | 414 | | |
414 | | - | |
| 415 | + | |
415 | 416 | | |
416 | 417 | | |
417 | | - | |
| 418 | + | |
418 | 419 | | |
419 | 420 | | |
420 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
213 | | - | |
| 213 | + | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
245 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
246 | 248 | | |
247 | | - | |
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
| |||
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
327 | 327 | | |
328 | | - | |
329 | 328 | | |
330 | 329 | | |
331 | 330 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
28 | | - | |
| 27 | + | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
| 33 | + | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
370 | 369 | | |
371 | 370 | | |
372 | 371 | | |
| |||
522 | 521 | | |
523 | 522 | | |
524 | 523 | | |
525 | | - | |
| 524 | + | |
526 | 525 | | |
527 | 526 | | |
528 | 527 | | |
| |||
546 | 545 | | |
547 | 546 | | |
548 | 547 | | |
549 | | - | |
| 548 | + | |
550 | 549 | | |
551 | 550 | | |
552 | 551 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
338 | 337 | | |
339 | 338 | | |
340 | 339 | | |
| |||
449 | 448 | | |
450 | 449 | | |
451 | 450 | | |
452 | | - | |
| 451 | + | |
453 | 452 | | |
454 | 453 | | |
455 | 454 | | |
| |||
472 | 471 | | |
473 | 472 | | |
474 | 473 | | |
475 | | - | |
| 474 | + | |
476 | 475 | | |
477 | 476 | | |
478 | 477 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
836 | | - | |
837 | 836 | | |
838 | 837 | | |
839 | 838 | | |
| |||
989 | 988 | | |
990 | 989 | | |
991 | 990 | | |
992 | | - | |
| 991 | + | |
993 | 992 | | |
994 | 993 | | |
995 | 994 | | |
| |||
0 commit comments