Skip to main content

Module download

Module download 

Source
Expand description

Remote files downloaded to local ones, and standard input spooled to one.

A download is read on one side and written on the thread that asked, never on a runtime worker, with at most QUEUED_CHUNKS waiting between the two: a full queue stops the reading, so a slow disk holds the transfer back instead of the file piling up in memory. A store’s stream is polled on the app’s runtime; a blocking reader (HTTP, standard input) runs on a thread of its own.

Structs§

TempDownload
A downloaded file, removed from disk when its last holder drops it: the app keeps one to read the file again, the dataset scanning it keeps another, and an event carrying one that is never handled removes it as it drops.

Enums§

StreamError
Why a download did not arrive whole.

Constants§

QUEUED_CHUNKS
Chunks queued between the side reading a download and the thread writing it.

Functions§

read_into
Run open on a thread of its own and hand each chunk read from the reader it answers with to write on this thread, in order. Returns the bytes written; a length open gives must be what arrives.
stream_into
Run open on runtime and hand each chunk of the stream it answers with to write on this thread, in order. Returns the bytes written.

Type Aliases§

Opened
What opening a download answers: its stream or reader and its length, when the source gave one, or why it could not be opened.