Class: Aws::S3::ObjectMultipartCopier Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-resources/services/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):

  • :client (Client)


21
22
23
24
25
# File 'lib/aws-sdk-resources/services/s3/object_multipart_copier.rb', line 21

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:

  • (Client)


28
29
30
# File 'lib/aws-sdk-resources/services/s3/object_multipart_copier.rb', line 28

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.



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/aws-sdk-resources/services/s3/object_multipart_copier.rb', line 31

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