Expand description
Disk decorators with operation hooks for storage tests.
HookDisk::new provides sparse RAM storage using [disklayer_ram], and
HookDisk::wrap decorates an existing Disk while preserving its
capabilities.
Use HookDisk::with_sync_hook to observe operation parameters or inject
errors, and HookDisk::with_async_hook to asynchronously gate I/O. Hooks
run before the operation; returning an error prevents it from reaching
storage. Hooks do not receive data buffers.
use disk_hook::{Disk, HookDisk};
let disk: Disk = HookDisk::new(4096, 512).into_disk();
assert_eq!(disk.sector_count(), 8);Use this crate as a dev-dependency, not as a production storage backend.
Structs§
- Disk
- An asynchronous block device.
- Hook
Disk - A RAM disk or disk decorator with an optional operation hook.
Enums§
- Disk
Error - A disk operation error.
- Disk
Operation - An operation about to be issued to a test disk.