Class: Aws::S3::ObjectMultipartCopier Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-s3/object_multipart_copier.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.

Defined Under Namespace

Classes: PartQueue

Constant Summary collapse

FIVE_MB =

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.

5MB

5 * 1024 * 1024
FILE_TOO_SMALL =

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.

"unable to multipart copy files smaller than 5MB"
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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ObjectMultipartCopier

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

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

  • [Integer] (Hash)

    a customizable set of options

Options Hash (options):


23
24
25
26
27
# File 'lib/aws-sdk-s3/object_multipart_copier.rb', line 23

def initialize(options = {})
  @thread_count = options.delete(:thread_count) || 10
  @min_part_size = options.delete(:min_part_size) || (FIVE_MB * 10)
  @client = options[:client] || Client.new
end

Instance Attribute Details

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

Returns:


30
31
32
# File 'lib/aws-sdk-s3/object_multipart_copier.rb', line 30

def client
  @client
end

Instance Method Details

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


33
34
35
36
37
38
39
40
41
42
43
# File 'lib/aws-sdk-s3/object_multipart_copier.rb', line 33

def copy(options = {})
  size = source_size(options)
  options[:upload_id] = initiate_upload(options)
  begin
    parts = copy_parts(size, default_part_size(size), options)
    complete_upload(parts, options)
  rescue => error
    abort_upload(options)
    raise error
  end
end