state->getPartGenerator()->getPartSize(); } /** * {@inheritdoc} */ protected function complete() { $partGenerator = $this->state->getPartGenerator(); $params = array_replace($this->state->getUploadId()->toParams(), array( 'archiveSize' => $partGenerator->getArchiveSize(), 'checksum' => $partGenerator->getRootChecksum(), Ua::OPTION => Ua::MULTIPART_UPLOAD )); $command = $this->client->getCommand('CompleteMultipartUpload', $params); return $command->getResult(); } /** * {@inheritdoc} */ protected function getAbortCommand() { $params = $this->state->getUploadId()->toParams(); $params[Ua::OPTION] = Ua::MULTIPART_UPLOAD; /** @var OperationCommand $command */ $command = $this->client->getCommand('AbortMultipartUpload', $params); return $command; } /** * Creates an UploadMultipartPart command from an UploadPart object * * @param UploadPart $part UploadPart for which to create a command * @param bool $useSourceCopy Whether or not to use the original source or a copy of it * * @return OperationCommand */ protected function getCommandForPart(UploadPart $part, $useSourceCopy = false) { // Setup the command with identifying parameters (accountId, vaultName, and uploadId) /** @var OperationCommand $command */ $command = $this->client->getCommand('UploadMultipartPart', $this->state->getUploadId()->toParams()); $command->set(Ua::OPTION, Ua::MULTIPART_UPLOAD); // Get the correct source $source = $this->source; if ($useSourceCopy) { $sourceUri = $this->source->getUri(); $source = new EntityBody(fopen($sourceUri, 'r')); } // Add the range, checksum, and the body limited by the range $command->set('range', $part->getFormattedRange()); $command->set('checksum', $part->getChecksum()); $command->set('ContentSHA256', $part->getContentHash()); $command->set('body', new ReadLimitEntityBody($source, $part->getSize(), $part->getOffset())); return $command; } }