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



255
256
257
258
259
260
# File 'lib/aws-sdk-s3/file_downloader.rb', line 255

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



262
263
264
265
266
267
268
# File 'lib/aws-sdk-s3/file_downloader.rb', line 262

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