예제 #1
0
 /**
  * {@inheritdoc}
  */
 public static function fromUploadId(AwsClientInterface $client, UploadIdInterface $uploadId)
 {
     $transferState = new self($uploadId);
     foreach ($client->getIterator('ListParts', $uploadId->toParams()) as $part) {
         $transferState->addPart(UploadPart::fromArray($part));
     }
     return $transferState;
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public static function fromUploadId(AwsClientInterface $client, UploadIdInterface $uploadId)
 {
     $transferState = new static($uploadId);
     $listParts = $client->getIterator('ListParts', $uploadId->toParams());
     foreach ($listParts as $part) {
         list($firstByte, $lastByte) = explode('-', $part['RangeInBytes']);
         $partSize = (double) $listParts->getLastResult()->get('PartSizeInBytes');
         $partData = array('partNumber' => $firstByte / $partSize + 1, 'checksum' => $part['SHA256TreeHash'], 'contentHash' => self::ALREADY_UPLOADED, 'size' => $lastByte - $firstByte + 1, 'offset' => $firstByte);
         $transferState->addPart(UploadPart::fromArray($partData));
     }
     return $transferState;
 }