Skip to main content

disk_fields

Function disk_fields 

Source
pub fn disk_fields(disk: &Option<Outcome>) -> CapacityResponse
Expand description

The wire’s disk_* fields out of one crate::disktest::Outcome, and nothing else set — the same shape and the same contract as machine_fields, so both arms of answer fill them the same way.

Absent, never zero, and never a fast disk. Every arm below either fills a number that was really measured or leaves the field None and says why in disk_reason. The one subtle case is cached: the read leg came back over crate::disktest::CACHED_BPS, which means the page cache answered and the device was never touched, so disk_seq_read_bps is ABSENT while the write and sync legs of the same run stand. A caller comparing two boxes must be able to tell “this disk is slow” from “this disk was not measured”, and that is the whole reason this function exists instead of a unwrap_or(0).