Rust

client

Module

The HTTP client S3 sends its requests through.

Contents

use utopia_storage::s3::client::HttpClient;
Rust
pub struct HttpClient

The default client: HTTP/1.1 over plain TCP or TLS (the web PKI's roots), keeping connections alive, with no overall deadline. Request payloads go out chunk by chunk, and Client::stream hands the response body over as it arrives.

Also implements Default.
use utopia_storage::s3::client::Payload;
Rust
pub struct Payload(Contents)

The body of a [Request]: bytes in memory, or a seekable Body streamed from its start each time the request is sent, so a retry sends the same bytes and only one chunk of a large upload is in memory at a time.

Rust
use utopia_storage::Body;
use utopia_storage::s3::Payload;

let payload = Payload::from_body(Body::from("Hello World"));
assert_eq!(&payload.bytes().await?[..], b"Hello World");
assert_eq!(&payload.bytes().await?[..], b"Hello World"); // read again from the start
Also implements Debug, From.
use utopia_storage::s3::client::Request;
Rust
pub struct Request

A request, as a Client sends it.

use utopia_storage::s3::client::Response;
Rust
pub struct Response<B = Bytes>

A response, as a Client returns it: its body in memory (Bytes, from Client::send) or still to read (Body, from Client::stream).

use utopia_storage::s3::client::Retry;
Rust
pub struct Retry<C>

A client that retries what a RetryStrategy says to. Each attempt sends the request's Payload again from its start.

use utopia_storage::s3::client::Method;
Rust
pub enum Method

An HTTP method S3 requests use.

use utopia_storage::s3::client::TransportError;
Rust
pub enum TransportError

Why a request got no response.

use utopia_storage::s3::client::Client;
Rust
pub trait Client: Send + Sync

Sends HTTP requests. Implement it to route S3 traffic through a client of your own (a proxy, a test double).

Implemented byArcRetryHttpClient