Skip to main content

ConfigLoader

Struct ConfigLoader 

Source
pub struct ConfigLoader { /* private fields */ }
Expand description

Loads transfer manager Config from the environment.

Created by from_env. load resolves the S3 client configuration from the shared AWS configuration sources (environment variables, shared config and credentials files, and the default credential and region provider chains) unless s3_config supplies one. It also detects the host’s EC2 instance type, vCPU count, and memory, which size the automatic defaults. Settings not configured on the loader keep their defaults.

Use Config::builder instead to construct a configuration from explicit values without loading or instance-metadata detection.

use aws_s3_transfer::config::PartSize;
use aws_s3_transfer::types::ByteSize;

let config = aws_s3_transfer::from_env()
    .part_size(PartSize::Target(ByteSize::mib(16)))
    .load()
    .await;
let client = aws_s3_transfer::Client::new(config);

Implementations§

Source§

impl ConfigLoader

Source

pub fn multipart_threshold(self, threshold: PartSize) -> Self

Minimum object size that should trigger a multipart upload.

The minimum part size is 5 MiB, any part size less than that will be rounded up. Default is PartSize::Auto

Source

pub fn part_size(self, part_size: PartSize) -> Self

The target size of each part when using a multipart upload to complete the request.

When a request’s content length is less than multipart_threshold, this setting is ignored and a single PutObject request will be made instead.

NOTE: The actual part size used may be larger than the configured part size if the current value would result in more than 10,000 parts for an upload request.

Default is PartSize::Auto

Source

pub fn concurrency(self, mode: ConcurrencyMode) -> Self

Set the concurrency mode this client should use.

This sets the mode used for concurrent in-flight requests across all operations. Default is ConcurrencyMode::Auto.

Source

pub fn runtime_config(self, config: RuntimeConfig) -> Self

Sets execution for transfer work.

Defaults to owned managed execution.

Source

pub fn read_ahead(self, mode: ReadAhead) -> Self

Set how far downloads may prefetch ahead of the consumer.

This is the client default for all downloads; a request may override it via DownloadInput, or a running transfer may adjust it via DownloadIoCtl. Default is ReadAhead::Auto.

Source

pub fn memory(self, memory: MemoryConfig) -> Self

Set the payload-memory configuration.

Default is MemoryConfig::Auto.

Source

pub fn s3_config(self, config: impl Into<S3ClientConfig>) -> Self

Use this S3 client configuration instead of loading shared AWS configuration.

When set, load reads no shared AWS configuration sources; it still detects the machine profile. Builder::s3_config describes how the transfer manager uses the configuration.

let config = aws_s3_transfer::from_env()
    .s3_config(&sdk_config)
    .load()
    .await;
Source

pub async fn load(self) -> Config

Load the configuration.

Without s3_config, the S3 client configuration is loaded from the shared AWS configuration sources with the latest behavior version. Machine detection always runs. Where local DMI can’t identify the host, as on every non-Linux host and in containers without DMI, load makes one EC2 instance metadata (IMDS) lookup: a single attempt with 500 ms connect and read timeouts. Setting AWS_EC2_METADATA_DISABLED to true, 1, yes or on (case-insensitive) suppresses it.

Trait Implementations§

Source§

impl Debug for ConfigLoader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConfigLoader

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more