Class: OCI::ObjectStorage::Transfer::Multipart::Internal::MultipartUploadPartsCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/object_storage/transfer/multipart/internal/multipart_upload_parts_collection.rb

Overview

Wraps a collection of parts to be uploaded to Object Storage in order to provide thread-safe access to the collection

Instance Method Summary collapse

Constructor Details

#initialize(parts = []) ⇒ MultipartUploadPartsCollection

Returns a new instance of MultipartUploadPartsCollection.



12
13
14
15
# File 'lib/oci/object_storage/transfer/multipart/internal/multipart_upload_parts_collection.rb', line 12

def initialize(parts = [])
  @parts = parts
  @lock = Mutex.new
end

Instance Method Details

#clear!Object



25
26
27
# File 'lib/oci/object_storage/transfer/multipart/internal/multipart_upload_parts_collection.rb', line 25

def clear!
  @lock.synchronize { @parts.clear }
end

#lengthObject Also known as: size



33
34
35
# File 'lib/oci/object_storage/transfer/multipart/internal/multipart_upload_parts_collection.rb', line 33

def length
  @lock.synchronize { @parts.length }
end

#push(part) ⇒ Object



17
18
19
# File 'lib/oci/object_storage/transfer/multipart/internal/multipart_upload_parts_collection.rb', line 17

def push(part)
  @lock.synchronize { @parts.push(part) }
end

#shiftObject



21
22
23
# File 'lib/oci/object_storage/transfer/multipart/internal/multipart_upload_parts_collection.rb', line 21

def shift
  @lock.synchronize { @parts.shift }
end

#to_aObject



29
30
31
# File 'lib/oci/object_storage/transfer/multipart/internal/multipart_upload_parts_collection.rb', line 29

def to_a
  @lock.synchronize { @parts.dup }
end