ConcurrentTransfer
extends AbstractTransfer
in package
A transfer type which executes in a concurrent fashion, i.e. with multiple workers uploading at once. Each worker is charged with uploading a particular chunk of data. The entity body is fragmented into n pieces - calculated by dividing the total size by the individual part size.
Tags
Table of Contents
- DEFAULT_PART_SIZE = 1073741824
- Default chunk size is 1GB.
- MAX_PART_SIZE = 5368709120
- Maximum chunk size is 5GB.
- MIN_PART_SIZE = 1048576
- Minimum chunk size is 1MB.
- $client : Client
- $defaultOptions : array<string|int, mixed>
- $entityBody : EntityBody
- $options : array<string|int, mixed>
- $partSize : int
- $transferState : TransferState
- The current state of the transfer responsible for, among other things, holding an itinerary of uploaded parts
- getOptions() : array<string|int, mixed>
- getPartSize() : mixed
- newInstance() : static
- setClient() : $this
- setEntityBody() : $this
- setOption() : $this
- setOptions() : $this
- setTransferState() : $this
- setup() : $this
- transfer() : mixed
- upload() : Response
- Initiates the upload procedure.
- validatePartSize() : mixed
- Make sure the part size falls within a valid range
- collectParts() : array<string|int, mixed>
- Partitions the entity body into an array - each worker is represented by a key, and the value is a ReadLimitEntityBody object, whose read limit is fixed based on this object's partSize value. This will always ensure the chunks are sent correctly.
- createManifest() : Response
- With large uploads, you must create a manifest file. Although each segment or TransferPart remains individually addressable, the manifest file serves as the unified file (i.e. the 5GB download) which, when retrieved, streams all the segments concatenated.
Constants
DEFAULT_PART_SIZE
Default chunk size is 1GB.
public
mixed
DEFAULT_PART_SIZE
= 1073741824
MAX_PART_SIZE
Maximum chunk size is 5GB.
public
mixed
MAX_PART_SIZE
= 5368709120
MIN_PART_SIZE
Minimum chunk size is 1MB.
public
mixed
MIN_PART_SIZE
= 1048576
Properties
$client
protected
Client
$client
The client object which handles all HTTP interactions
$defaultOptions
protected
array<string|int, mixed>
$defaultOptions
= array('concurrency' => true, 'partSize' => self::DEFAULT_PART_SIZE, 'prefix' => 'segment', 'doPartChecksum' => true)
Defaults that will always override user-defined options
$entityBody
protected
EntityBody
$entityBody
The payload being transferred
$options
protected
array<string|int, mixed>
$options
User-defined key/pair options
$partSize
protected
int
$partSize
$transferState
The current state of the transfer responsible for, among other things, holding an itinerary of uploaded parts
protected
TransferState
$transferState
Methods
getOptions()
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —getPartSize()
public
getPartSize() : mixed
Return values
mixed —newInstance()
public
static newInstance() : static
Return values
static —setClient()
public
setClient(Client $client) : $this
Parameters
- $client : Client
Return values
$this —setEntityBody()
public
setEntityBody(EntityBody $entityBody) : $this
Parameters
- $entityBody : EntityBody
Return values
$this —setOption()
public
setOption( $option, $value) : $this
Parameters
Return values
$this —setOptions()
public
setOptions( $options) : $this
Parameters
Return values
$this —setTransferState()
public
setTransferState(TransferState $transferState) : $this
Parameters
- $transferState : TransferState
Return values
$this —setup()
public
setup() : $this
Return values
$this —transfer()
public
transfer() : mixed
Return values
mixed —upload()
Initiates the upload procedure.
public
upload() : Response
Tags
Return values
Response —validatePartSize()
Make sure the part size falls within a valid range
protected
validatePartSize() : mixed
Return values
mixed —collectParts()
Partitions the entity body into an array - each worker is represented by a key, and the value is a ReadLimitEntityBody object, whose read limit is fixed based on this object's partSize value. This will always ensure the chunks are sent correctly.
private
collectParts(mixed $workers) : array<string|int, mixed>
Parameters
- $workers : mixed
Return values
array<string|int, mixed> —The worker array
createManifest()
With large uploads, you must create a manifest file. Although each segment or TransferPart remains individually addressable, the manifest file serves as the unified file (i.e. the 5GB download) which, when retrieved, streams all the segments concatenated.
private
createManifest() : Response