pub struct DirectDownloadStream { /* private fields */ }Expand description
One direct download response, delivered in bounded chunks and verified against the content reference carried by its grant.
Verification completes only when Self::next_chunk returns None.
A caller that stops earlier has received provisional bytes, just as with
any streaming read whose digest cannot be known until the end.
Implementations§
Source§impl DirectDownloadStream
impl DirectDownloadStream
Sourcepub fn fold_resumed_prefix(&mut self, bytes: &[u8])
pub fn fold_resumed_prefix(&mut self, bytes: &[u8])
Hands the stream part of what the caller already holds, in order, from the object’s first byte.
A resumed download still checks the whole object’s digest, so the bytes it will never receive have to be folded into the same hash as the ones it does. Feeding the wrong bytes fails the download at its end, which is right: the grant’s reference is the authority on what the object holds, not the partial copy on the caller’s disk.
Sourcepub async fn next_chunk(&mut self) -> Result<Option<Bytes>>
pub async fn next_chunk(&mut self) -> Result<Option<Bytes>>
Returns the next response-body chunk, or None once the complete
object has passed its declared-length and whole-file digest checks.