Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
dragonfly-client-request
Request library for the Dragonfly client. It sends requests to remote servers via the Dragonfly P2P network, supporting streaming and buffered GET requests and preheating files or OCI images through seed peers.
Usage
use ;
use TryStreamExt;
let proxy = builder
.scheduler_endpoint
.build
.await?;
let response = proxy
.get
.await?;
// The body is a stream of zero-copy `Bytes` chunks.
let mut body = response.body.unwrap;
while let Some = body.try_next.await?
Preheat with multiple replicas and scatter downloads across them. Preheating writes the file to the given number of distinct seed peers, and downloading scatters each request across those replicas by picking a random one, retrying on the others up to the max retries. Preheating fails when the available seed peers are fewer than the replicas, while downloading clamps the replicas to the available seed peers. The default replicas is 2:
proxy
.preheat
.await?;
let response = proxy
.get
.await?;
Retry transient failures. A request is retried on another seed peer when the
peer cannot be reached or answers too slowly, or the proxy, backend or dfdaemon
answers 5xx, 408 or 429, since another seed peer may not be rate limited or
out of space. Any other answer, such as 404 or a dfdaemon 422, is definitive
and returns at once. get_into also retries a failed body read, get cannot
once the body is streaming. Preheating retries the same way on each replica
seed peer.
The default is one retry at once and max_retries(0) disables retries. An
exponential backoff spreads the retries out, ExponentialBuilder being
re-exported from backon. The request timeout applies
to each attempt:
use ExponentialBuilder;
use Duration;
let proxy = builder
.scheduler_endpoint
.max_retries
.backoff
.build
.await?;
Look up the endpoints of the seed peers serving a request, then create a proxy bound to those endpoints and download from them directly, scattering the request across them. The endpoints proxy keeps a client with a reusable connection pool per endpoint and doesn't sync seed peers from the scheduler:
let request = GetRequest ;
let endpoints = proxy.lookup_endpoints.await?;
let proxy_with_endpoints = builder
.endpoints
.build
.await?;
let response = proxy_with_endpoints.get.await?;
// Or write the response body directly into a buffer:
// let response = proxy_with_endpoints.get_into(&request, &mut buf).await?;
The preheat feature enables preheating OCI images by resolving manifests from
the registry and triggering seed peers to download each blob, and querying the
distribution of an OCI image with the layers cached by each seed peer:
[]
= { = "1.6.1", = ["preheat"] }
proxy
.preheat_image
.await?;
let response = proxy
.stat_image
.await?;
See examples for runnable examples.
Documentation
You can find the full documentation on d7y.io.
LICENSE
Apache 2.0 License. Please see LICENSE for more information.