/usr/share/php/Aws/Multipart/UploadState.php is in php-aws-sdk 3.15.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | <?php
namespace Aws\Multipart;
/**
* Representation of the multipart upload.
*
* This object keeps track of the state of the upload, including the status and
* which parts have been uploaded.
*/
class UploadState
{
const CREATED = 0;
const INITIATED = 1;
const COMPLETED = 2;
/** @var array Params used to identity the upload. */
private $id;
/** @var int Part size being used by the upload. */
private $partSize;
/** @var array Parts that have been uploaded. */
private $uploadedParts = [];
/** @var int Identifies the status the upload. */
private $status = self::CREATED;
/**
* @param array $id Params used to identity the upload.
*/
public function __construct(array $id)
{
$this->id = $id;
}
/**
* Get the upload's ID, which is a tuple of parameters that can uniquely
* identify the upload.
*
* @return array
*/
public function getId()
{
return $this->id;
}
/**
* Set's the "upload_id", or 3rd part of the upload's ID. This typically
* only needs to be done after initiating an upload.
*
* @param string $key The param key of the upload_id.
* @param string $value The param value of the upload_id.
*/
public function setUploadId($key, $value)
{
$this->id[$key] = $value;
}
/**
* Get the part size.
*
* @return int
*/
public function getPartSize()
{
return $this->partSize;
}
/**
* Set the part size.
*
* @param $partSize int Size of upload parts.
*/
public function setPartSize($partSize)
{
$this->partSize = $partSize;
}
/**
* Marks a part as being uploaded.
*
* @param int $partNumber The part number.
* @param array $partData Data from the upload operation that needs to be
* recalled during the complete operation.
*/
public function markPartAsUploaded($partNumber, array $partData = [])
{
$this->uploadedParts[$partNumber] = $partData;
}
/**
* Returns whether a part has been uploaded.
*
* @param int $partNumber The part number.
*
* @return bool
*/
public function hasPartBeenUploaded($partNumber)
{
return isset($this->uploadedParts[$partNumber]);
}
/**
* Returns a sorted list of all the uploaded parts.
*
* @return array
*/
public function getUploadedParts()
{
ksort($this->uploadedParts);
return $this->uploadedParts;
}
/**
* Set the status of the upload.
*
* @param int $status Status is an integer code defined by the constants
* CREATED, INITIATED, and COMPLETED on this class.
*/
public function setStatus($status)
{
$this->status = $status;
}
/**
* Determines whether the upload state is in the INITIATED status.
*
* @return bool
*/
public function isInitiated()
{
return $this->status === self::INITIATED;
}
/**
* Determines whether the upload state is in the COMPLETED status.
*
* @return bool
*/
public function isCompleted()
{
return $this->status === self::COMPLETED;
}
}
|