Skip to main content

hash_reader

Function hash_reader 

Source
pub fn hash_reader(
    reader: impl Read,
    max_bytes: u64,
) -> Result<ArtifactIdentity, ArtifactError>
Expand description

Hash one stream with constant working memory and no reliance on metadata.

Reads at most max_bytes + 1 bytes, using the extra byte to detect overflow. Retries interrupted reads only; no subprocess or network retry is performed. A blocking reader’s timeouts remain the caller’s responsibility.

§Errors

Returns ArtifactError::LimitExceeded or the underlying read error. An impossible reader byte count returns IO io::ErrorKind::InvalidData.