Skip to main content

store_files

Function store_files 

Source
async fn store_files<R: AsyncRead + Unpin>(
    svc: &Arc<Service>,
    files: &[JektFile],
    reader: &mut R,
    tier: &str,
    derive: bool,
) -> Result<(), String>
Expand description

Stream each file into the store, keeping the ones whose bytes match their hash and size. A file that doesn’t is dropped, and the list says it didn’t arrive; a stream that ends early leaves the rest missing.

Held to the limits of tier here as well as by the caller’s manifest check: nothing is created for a file whose declared size, or the running total of the message, is over them, and a body that goes on after the last file is refused. At most the declared bytes of a file are ever written, and a partial file is removed.

With derive unset (the sender is not proven) a file is stored as it arrived and nothing is read from it: no type sniffing, preview or text.