Class: Aws::S3::FileDownloader Private
- Inherits:
-
Object
- Object
- Aws::S3::FileDownloader
- Defined in:
- lib/aws-sdk-s3/file_downloader.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- MIN_CHUNK_SIZE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
5 * 1024 * 1024
- MAX_PARTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
10_000
- THREAD_COUNT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
10
Instance Attribute Summary collapse
- #client ⇒ Client readonly private
Instance Method Summary collapse
- #download(destination, options = {}) ⇒ Object private
-
#initialize(options = {}) ⇒ FileDownloader
constructor
private
A new instance of FileDownloader.
Constructor Details
#initialize(options = {}) ⇒ FileDownloader
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of FileDownloader.
15 16 17 |
# File 'lib/aws-sdk-s3/file_downloader.rb', line 15 def initialize( = {}) @client = [:client] || Client.new end |
Instance Attribute Details
#client ⇒ Client (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/aws-sdk-s3/file_downloader.rb', line 20 def client @client end |
Instance Method Details
#download(destination, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/aws-sdk-s3/file_downloader.rb', line 22 def download(destination, = {}) @path = destination @mode = [:mode] || "auto" @thread_count = [:thread_count] || THREAD_COUNT @chunk_size = [:chunk_size] @params = { bucket: [:bucket], key: [:key], } @params[:version_id] = [:version_id] if [:version_id] case @mode when "auto" then multipart_download when "single_request" then single_request when "get_range" if @chunk_size resp = @client.head_object(@params) multithreaded_get_by_ranges(construct_chunks(resp.content_length)) else msg = "In :get_range mode, :chunk_size must be provided" raise ArgumentError, msg end else msg = "Invalid mode #{@mode} provided, "\ "mode should be :single_request, :get_range or :auto" raise ArgumentError, msg end end |