Skip to main content

validate_throttle

Function validate_throttle 

Source
pub fn validate_throttle(
    field: &str,
    throttle: &Throttle,
) -> Vec<ValidationError>
Expand description

Validate every SET knob of a Throttle: a cap is a positive rate, so each present field must be >= 1. field names the block’s path for the message (e.g. "SnapshotReplication spec.migrate.throttle.source"), and each knob’s own camelCase name is appended.

A 0 is refused rather than read as “unlimited”: kopia’s own “no limit” is the ABSENT field, so accepting 0 would give one wire value two plausible meanings (uncapped vs. stalled) — and the one it actually has in kopia is a hard stop. Exhaustively destructured, so a fifth knob cannot be added without deciding its bound here.