Skip to main content

fetch_blob

Function fetch_blob 

Source
pub async fn fetch_blob<S: BlobSource>(
    source: &S,
    hash: &str,
    expected_len: u64,
) -> Result<Vec<u8>, FetchError>
Expand description

Fetch a whole blob with resumable Range windows, verifying the reassembled ciphertext against its content address.

The unmetered convenience over RangedFetcher: each request resumes from the current buffer length, so an interruption re-fetches zero bytes already held, and on completion the SHA-256 of the assembled ciphertext must equal hash or the blob is discarded (FetchError::IntegrityFailed). A caller on a detected ConnectionClass::Adverse link builds RangedFetcher::new(Adverse) instead to get bounded transfer windows.