Skip to content
Snippets Groups Projects
Unverified Commit 3073a0a2 authored by Tanguy Le Barzic's avatar Tanguy Le Barzic Committed by GitHub
Browse files

Allow to specify a read buffer initial capacity when creating ByteStream from a file (#1238)


* Allow to specify a read buffer initial capacity when creating ByteStream from a file

The behaviour of the existing ByteStream::from_file / ByteStream::from_path is unchanged (using a default buffer capacity of 4k, which corresponds to Tokio's ReaderStream default buffer capacity). Using higher buffer sizes can result in a large reduction in CPU during S3 uploads, at the cost of memory increase.

* Rename len to file_size

This makes the distinction with the buffer size clearer

* Use a builder to specify advanced options to create a ByteStream

* Improved comments

* Specify the unit to use for PathBodyBuilder.with_file_size

* Improved comments following review

* Rename PathBodyBuilder to FsBuilder

* Renaming in FsBuilder

- renames `with_buffer_size` to `buffer_size`
- renames `with_file_size` to `file_size`
- renames `byte_stream` to `build`

* Make PathBody private

* Updated API for FsBuilder

* Document panic behavior of ByteStream::build

* Document ByteStream::read_from

* Move ByteStream::read_from

No functional change

* Update rust-runtime/aws-smithy-http/src/byte_stream.rs

a -> an

Co-authored-by: default avatarRussell Cohen <russell.r.cohen@gmail.com>
Co-authored-by: default avatarRussell Cohen <rcoh@amazon.com>
parent 125328da
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment