fn verify(
path: &Path,
spec: &ModelSpec,
on_progress: &mut (dyn FnMut(Progress) -> ControlFlow<()> + '_),
) -> Result<Option<String>, Error>Expand description
Check path against the spec, hashing only what there is a digest for.
Size first, then digest: a truncated file is the common case and
costs one stat to reject.
The digest compared here is always the spec’s own, never a server
ETag: HuggingFace answers with a chunked xet etag that is a
different value from the file’s SHA-256, so trusting it would reject
a perfectly good file forever.
Returns the digest when one was computed. A spec with no digest - a model whose upstream publishes none - gets its size checked and nothing more, and the caller records nothing: there is nothing to remember.