feat: S3 transfer manager improvements#3247
feat: S3 transfer manager improvements#3247yenfryherrerafeliz wants to merge 19 commits intoaws:masterfrom
Conversation
Until phpunit10 support is release we must use annotations for covers and dataProvider within tests.
| */ | ||
| public static function computeObjectSizeFromContentRange( | ||
| string $contentRange | ||
| ): int |
There was a problem hiding this comment.
does this return int or string?
There was a problem hiding this comment.
Integer. It basically returns the object size from the content range.
There was a problem hiding this comment.
what I was getting at is you might need a cast to int because the size is being extracted from preg_match()
| * | ||
| * @return string|null | ||
| */ | ||
| public static function filterChecksum(array $parameters):? string |
There was a problem hiding this comment.
nit: no space after nullable for return types
There was a problem hiding this comment.
this one is still out of position- should be : ?string
- Address some formatting issues. - Fixed arguments passed to ResumableDownload - Add test coverage for: - DirectoryProgressTracker - DirectoryTransferProgressAggregator - DirectoryTransferProgressSnapshot - DirectoryDownloader - DirectoryUploader
|
stobrien89
left a comment
There was a problem hiding this comment.
Just a few more questions/comments
| * | ||
| * @return bool | ||
| */ | ||
| private function writePartToDestinationHandle(array $response): bool |
There was a problem hiding this comment.
Question: do part numbers start at 1 or 0? If zero, I think this might be exposed to an off-by-one error
There was a problem hiding this comment.
Part numbers start at 1 actually.
| $this->body->rewind(); | ||
| } | ||
|
|
||
| $partNo = 0; |
There was a problem hiding this comment.
Does resume data store 1-based part numbers? Might be a mismatch during resume skip logic
There was a problem hiding this comment.
$partNo is incremented at line 388, which will unlikely cause a resumable
persist mismatch. Is there any other mismatch you are referring to here, that I
may be missing?
| $chunk = $body->read(self::READ_BUFFER_SIZE); | ||
|
|
||
| if (fwrite($this->handle, $chunk) === false) { | ||
| throw new FileDownloadException("Failed to write data to temporary file."); |
There was a problem hiding this comment.
question: where do these exceptions bubble up to?
- Add validation for when resuming an upload and the source file changed - Add test coverage for the behavior when resuming upload and source file changed - Address some styling issues
stobrien89
left a comment
There was a problem hiding this comment.
A couple more comments. Thanks for making the changes to the CBOR tests also
| */ | ||
| public static function computeObjectSizeFromContentRange( | ||
| string $contentRange | ||
| ): int |
There was a problem hiding this comment.
what I was getting at is you might need a cast to int because the size is being extracted from preg_match()
| * | ||
| * @return string|null | ||
| */ | ||
| public static function filterChecksum(array $parameters):? string |
There was a problem hiding this comment.
this one is still out of position- should be : ?string
| $headResult = $this->s3Client->headObject([ | ||
| 'Bucket' => $resumableDownload->getBucket(), | ||
| 'Key' => $resumableDownload->getKey(), | ||
| ]); |
There was a problem hiding this comment.
Could be wrong, but shouldn't this be headObjectAsync() since its inside an async workflow?
| $uploads = $this->s3Client->listMultipartUploads([ | ||
| 'Bucket' => $resumableUpload->getBucket(), | ||
| 'Prefix' => $resumableUpload->getKey(), | ||
| ]); |
There was a problem hiding this comment.
Should this also be paginated like the ListObjectsV2 call?
| private const UPLOAD_DIRECTORY_CROSS_PLATFORM_BASE_CASES = __DIR__ . '/test-cases/upload-directory-cross-platform-compatibility.json'; | ||
| private const DOWNLOAD_DIRECTORY_CROSS_PLATFORM_BASE_CASES = __DIR__ . '/test-cases/download-directory-cross-platform-compatibility.json'; |
There was a problem hiding this comment.
Did these tests get moved or removed entirely?
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.