ostrya-fetch
Ostrya [n. a botanical genus within the family Betulaceae, commonly known as ironwood tree] is a pure-Rust, async implementation of the ostree repository system, written from scratch.
An async HTTP/1.1 and HTTP/2 client over rustls, for the mirrors of a remote.
A caller builds a Fetcher from the mirrors, headers, credentials, proxy,
TLS configuration, retry limits, and deadlines of one remote. The fetcher
downloads files with GET and sends uploads with POST, PUT, or
DELETE. A response body streams in bounded chunks, so no object is held
whole in memory.
The Target of a request is a path under each mirror, a path with a
query string under each mirror, or an absolute URL. The fetcher sends a
path and a query as written, so the caller escapes them. A fetcher with a
RequestSigner sends a path in the form that
RequestSigner::request_path gives.
A failed fetch gives the status of the response. On request, it also gives the headers and a capped body of that response.
API documentation: https://docs.rs/ostrya-fetch
Entry points
Fetcher::newbuilds a fetcher fromFetcherOptions.Fetcher::fetchsends aFetchRequestand returns aFetched.ErrorResponseholds the headers and the capped body of an unsuccessful response, if the request asks for them.Bodystreams a response body in bounded chunks.Fetcher::refetchingreturns aRefetch, which fetches a failed body again.Fetcher::uploadsends anUploadRequestand returns anUploaded.UploadBodygives an upload body whole or streams it from anUploadWriter.RequestSignersigns each attempt throughFetcherOptions::signer, and gives the form of each request path.Erroris the error of each fallible operation of the crate.
Modules
gate: the priority admission gate that bounds concurrent work.
Features
smol(default): thesmolbackend ofostrya-rt.tokio: thetokiobackend ofostrya-rt, with tokio I/O impls onBodyandUploadWriter.
Examples
use AsyncReadExt;
use ;
let fetcher = new.await?;
if let Body = fetcher.fetch.await?