pub async fn pull_over_channel(
client: &PeerClient,
address: &str,
len: u64,
held: &mut Vec<u8>,
) -> Result<Vec<u8>, PeeringError>Expand description
Pull the artifact address (len bytes) from the serving peer over client, through the
same resumable, content-address-verified ranged fetch as pull_artifact.
held is what an earlier, severed pull of the same artifact received (empty for a fresh
pull): the pull resumes after it and re-fetches none of it. On success the whole verified
artifact is returned and held is left empty; when the channel fails, held keeps every
byte received so far for the next attempt; when the bytes do not hash to address, held
is cleared, since some of it is wrong.
§Errors
The channel’s failure (PeeringError::PeerRefused, PeeringError::Io,
PeeringError::Timeout, …), PeeringError::Codec for a length past
MAX_ARTIFACT_LEN, or PeeringError::Transfer when the bytes do not verify.