Struct s3_sync::S3

source ·
pub struct S3 { /* private fields */ }
Expand description

Wrapper of Rusoto S3 client that adds some high level imperative and declarative operations on S3 buckets and objects.

Implementations

Creates high level S3 client.

  • region - the AWS region to connect to; when None autodetects the region value (see Region for detail)
  • region_endpoint - use dedicated AWS endpoint within the region
  • settings - use specific client setting

Creates high level S3 client with given region and default settings.

Gets maximum size of the multipart upload part.

Useful to set up other I/O buffers accordingly.

Returns maximum size of data in bytes that can be uploaded to a single object with current settings.

Set callback on body upload progress.

Calls f with S3 client that has S3::on_upload_progress() set to callback and restores callback to previous state on return.

Checks if given bucket exists.

Checks if given object exists.

  • implementation - select implementation of this function

Note:

Checks if given object exists by issuing HeadObject API request.

Note:

Checks if given object exists by listing objects with ListObjcetsV2 API request.

Note:

Provides iterator of objects in existing bucket that have key of given prefix.

Note:

Gets object body.

Gets object body retrying the operation in case of an error.

  • retires - retry get_body call up to that many times
  • on_error - called when get_body call fails and there are still retries left; if gets number of retries left and the error and if it returns false the retry loop is aborted

Note:

  • The on_error closure may need to pause the execution of the thread to delay next retry attempt.
  • Once this function returns, the subsequent read operation failures are not retried.

Creates the S3 object with given body using multipart upload API.

Warning: Existing object will be overwritten (subject to bucket versioning settings).

The size of the body is limited to value returned by S3::max_upload_size(). Increase Settings::part_size to be able to upload more data (max_upload_size = part_size * 10_000 on AWS; with default settings the limit is 100_000 MiB).

Deletes single object.

Note: Delete call does not fail if object does not exist.

To delete many objects use S3::delete_objects() witch uses bulk delete API.

Deletes list of objects in streaming fashion using bulk delete API.

Warning: If returned iterator is not completely consumed not all items from the list may be deleted.

It is not an error to delete non-existing S3 object.

Objects can live in different buckets but for best performance it is recommended to order the list by bucket so that biggest batches can be crated.

Each returned item represent batch delete call to S3 API.

Successful batch call will return Result::Ok variant containing vector of results for each individual object delete operation as provided by S3.

Returns Ensure value that can be used to ensure that object is present in the S3 bucket.

If S3 object does not exist this method will call body function to obtain Read and metadata values, then data read will be uploaded to the new S3 object with given metadata set on it.

Warning: There can be a race condition between check if object exists and the upload creating it.

Returns Ensure value that can be used to ensure that object is absent in the S3 bucket.

Warning: There can be a race condition between check if object exists and the delete operation.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.