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

Options Hash (options):

  • :client (Client)
  • :min_part_size (Integer) — default: 52428800

    Size of copied parts. Defaults to 50MB.

  • :thread_count (Integer) — default: 10

    Number of concurrent threads to use for copying parts.

  • :use_source_parts (Boolean) — default: false

    Use part sizes defined on the source object if any exist. If copying or moving an object that is already multipart, this does not re-part the object, instead re-using the part definitions on the original. That means the etag and any checksums will not change. This is especially useful if the source object has parts with varied sizes.



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

def initialize(options = {})
  @use_source_parts = options.delete(:use_source_parts) || false
  @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:



36
37
38
# File 'lib/aws-sdk-s3/object_multipart_copier.rb', line 36

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.



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/aws-sdk-s3/object_multipart_copier.rb', line 39

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