Crate mountpoint_s3_client

Source
Expand description

An Amazon S3 client built on top of the AWS Common Runtime (AWS CRT).

This crate provides a high-performance implementation of an Amazon S3 client that uses the AWS Common Runtime (CRT). The CRT is a software library for interacting with AWS services, offering components like IO, HTTP, and encryption. The CRT is purpose-built for high performance and low resource usage to make the most efficient use of your compute resources. For Amazon S3, the CRT includes a client that implements best practice performance design patterns, including timeouts, retries, and automatic request parallelization for high throughput.

This crate is not intended for general-purpose use and we consider its interface to be unstable. Customers looking for a general-purpose Amazon S3 client in Rust should use the official AWS SDK for Rust.

§Example

To construct a new S3 client and download an object from a bucket in the us-east-1 region:

use futures::{TryFutureExt, TryStreamExt};
use mountpoint_s3_client::types::GetObjectParams;
use mountpoint_s3_client::{S3CrtClient, ObjectClient};

let client = S3CrtClient::new(Default::default()).expect("client construction failed");

let response = client.get_object("my-bucket", "my-key", &GetObjectParams::new()).await.expect("get_object failed");
let body = response.map_ok(|part| part.data.to_vec()).try_concat().await.expect("body streaming failed");

To further configure the client, use the S3ClientConfig builder:

use mountpoint_s3_client::S3CrtClient;
use mountpoint_s3_client::config::{S3ClientAuthConfig, S3ClientConfig, EndpointConfig};

let config = S3ClientConfig::new()
                .endpoint_config(EndpointConfig::new("us-west-2"))
                .auth_config(S3ClientAuthConfig::NoSigning);
let client = S3CrtClient::new(config).expect("client construction failed");

Modules§

checksums
Provides base64 encoding/decoding for various checksums.
config
Configuration for the S3 client
error
Errors returned by all object clients.
error_metadata
imds_crt_client
An Instance Metadata Service (IMDS) client using the AWS Common Runtime implementation.
instance_info
A simple interface to retrieve information about the EC2 instance this client is running on by querying the Instance Metadata Service (IMDS).
types
Types used by all object clients

Structs§

S3CrtClient
An S3 client that uses the AWS Common Runtime (CRT) to make requests.
S3GetObjectResponse
A streaming response to a GetObject request.
S3PutObjectRequest
An in-progress streaming PutObject request to S3.

Enums§

S3RequestError
Errors returned by the CRT-based S3 client

Traits§

ObjectClient
A generic interface to S3-like object storage services.
OnTelemetry
Custom handling of telemetry events
PutObjectRequest
A streaming put request which allows callers to asynchronously write the body of the request.