Class: Aws::S3::FileDownloader::MultipartProgress Private

Inherits:
Object
  • Object
show all
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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parts, total_size, progress_callback) ⇒ MultipartProgress

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 MultipartProgress.



299
300
301
302
303
304
# File 'lib/aws-sdk-s3/file_downloader.rb', line 299

def initialize(parts, total_size, progress_callback)
  @bytes_received = Array.new(parts.size, 0)
  @part_sizes = parts.map(&:size)
  @total_size = total_size
  @progress_callback = progress_callback
end

Instance Attribute Details

#progress_callbackObject (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.



306
307
308
# File 'lib/aws-sdk-s3/file_downloader.rb', line 306

def progress_callback
  @progress_callback
end

Instance Method Details

#call(part_number, bytes_received, total) ⇒ 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.



308
309
310
311
312
313
314
# File 'lib/aws-sdk-s3/file_downloader.rb', line 308

def call(part_number, bytes_received, total)
  # part numbers start at 1
  @bytes_received[part_number - 1] = bytes_received
  # part size may not be known until we get the first response
  @part_sizes[part_number - 1] ||= total
  @progress_callback.call(@bytes_received, @part_sizes, @total_size)
end