#1301
fix(storage): reject invalid device and engine configs
Move default-capacity discovery and storage-engine validation out of panic paths and into fallible, type-driven APIs.
What changed:
FileDeviceBuildernow probes block-device capacity or parent-directory free space through fallible helpers instead ofunwrap/expect.FsDeviceBuildernow computes default capacity lazily and returnsErrorif filesystem probing fails.BlockEngineConfigandUringIoEngineConfignow useNonZeroUsizefor counts and depths, so zero values are rejected at compile time for normal callers.- CPU pinning now uses nonempty CPU sets to set thread count, leaves pinning off when the CPU set is empty, and rejects mismatched
with_cpus(...)/with_threads(...)combinations up front.
Tests added:
test_file_device_builder_rejects_path_without_parenttest_fs_device_builder_propagates_dir_creation_errorstest_uring_empty_cpu_sets_disable_pinningtest_uring_rejects_mismatched_cpu_count
Activity
5Codecov Report
:x: Patch coverage is 87.58621% with 18 lines in your changes missing coverage. Please review.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| foyer-bench/src/main.rs | 70.02% <50.00%> (+0.22%) | :arrow_up: |
| foyer-storage/src/engine/block/engine.rs | 93.46% <96.66%> (-0.08%) | :arrow_down: |
| foyer-storage/src/io/device/fs.rs | 92.30% <88.88%> (+0.47%) | :arrow_up: |
| foyer-storage/src/io/engine/mod.rs | 94.66% <85.71%> (-1.05%) | :arrow_down: |
| foyer-storage/src/store.rs | 86.33% <83.33%> (-0.10%) | :arrow_down: |
| foyer-storage/src/io/device/file.rs | 70.17% <77.27%> (+7.31%) | :arrow_up: |
| foyer-storage/src/io/engine/uring.rs | 87.81% <88.40%> (+0.85%) | :arrow_up: |
... and 2 files with indirect coverage changes
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
I'll be back at this in a couple days to add more tests if y'all need, I try not to leave drive-by PRs. just ran out of time.
--
我过几天会再回来继续补测试,如果你们需要的话。我尽量不留那种丢完就跑的 PR,只是这次实在没时间了。
Tightened the
io_uringCPU affinity path a bit more: a nonempty CPU list still sets the thread count, but we now reject mismatchedwith_cpus(...)/with_threads(...)combinations up front instead of letting them reach an index panic inbuild(). Added tests for both the mismatch and the empty-list “disable pinning” case.