pub fn align_range_clamped(
byte_offset: u64,
byte_len: u64,
blob_size: u64,
) -> Result<AlignedRange, RangeVerifyError>Expand description
align_range, but an end past the blob clamps to the blob’s end instead
of being refused: a claimed size is a hint, and the planner’s bound can
overshoot it. Only byte_offset >= blob_size (for a non-empty blob) is
refused, with RangeVerifyError::RangeOutOfBounds: a start past the end
has no chunk group to anchor, clamped or not. (0, 0) means the whole
blob, and the empty blob is addressable only as (0, 0), exactly as in
align_range.
Both a node deciding what to serve and a client deciding what wire length to expect call this, so the two always agree on the served range.
§Errors
RangeVerifyError::RangeOutOfBounds if byte_offset is at or past a
non-empty blob’s end, or (for the empty blob) the request is not (0, 0).