-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: s3 transfer manager v2 #3079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 32 commits
3093732
5950c31
1c82ab5
237fc7b
c28c165
34321b2
5289f7c
c6c0780
034b50d
bc15ac3
e681d10
1f094cd
464b498
09e493f
f10522b
a55e1b3
b271897
f4f1c88
d987aff
6d000f1
27570d0
1dde7fc
060e0e1
ee0fefb
9f639f1
bdce369
cd2133a
0426e11
a548ce2
5a25ad8
64fc3f6
908b4a0
1e643e5
48a2822
02b43f0
153227b
31dbd19
aeed758
26d2469
10928ca
632ece9
6efcc0a
b0c5f75
44f6ff4
83ccd9b
039a67b
50715d1
3034ad8
cfe4ab5
f4c42e0
9fb03f1
4268266
59a8aa4
45ac289
20ada71
e7842ed
7c52a2f
fa664b1
d2d4688
e6a141f
e80eeff
ec383d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
yenfryherrerafeliz marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
@s3-transfer-manager @integ | ||
Feature: S3 Transfer Manager | ||
S3 Transfer Manager should successfully do: | ||
- object uploads | ||
- object multipart uploads | ||
- object downloads | ||
- object multipart downloads | ||
- directory object uploads | ||
- directory object downloads | ||
|
||
Scenario Outline: Successfully does a single file upload | ||
Given I have a file <filename> with content <content> | ||
When I upload the file <filename> to a test bucket using the s3 transfer manager | ||
Then the file <filename> should exist in the test bucket and its content should be <content> | ||
|
||
Examples: | ||
| filename | content | | ||
| myfile-test-1-1.txt | Test content #1 | | ||
| myfile-test-1-2.txt | Test content #2 | | ||
| myfile-test-1-3.txt | Test content #3 | | ||
|
||
|
||
Scenario Outline: Successfully does a single upload from a stream | ||
Given I have a stream with content <content> | ||
When I do the upload to a test bucket with key <key> | ||
Then the object <key>, once downloaded from the test bucket, should match the content <content> | ||
Examples: | ||
| content | key | | ||
| "This is a test text - 1" | myfile-test-2-1.txt | | ||
| "This is a test text - 2" | myfile-test-2-2.txt | | ||
| "This is a test text - 3" | myfile-test-2-3.txt | | ||
|
||
Scenario Outline: Successfully do multipart object upload from file | ||
Given I have a file with name <filename> where its content's size is <filesize> | ||
When I do upload this file with name <filename> with the specified part size of <partsize> | ||
Then the object with name <filename> should have a total of <partnum> parts and its size must be <filesize> | ||
Examples: | ||
| filename | filesize | partsize | partnum | | ||
| myfile-test-3-1.txt | 10485760 | 5242880 | 2 | | ||
| myfile-test-3-2.txt | 24117248 | 5242880 | 5 | | ||
| myfile-test-3-3.txt | 24117248 | 8388608 | 3 | | ||
|
||
Scenario Outline: Successfully do multipart object upload from streams | ||
Given I have want to upload a stream of size <filesize> | ||
When I do upload this stream with name <filename> and the specified part size of <partsize> | ||
Then the object with name <filename> should have a total of <partnum> parts and its size must be <filesize> | ||
Examples: | ||
| filename | filesize | partsize | partnum | | ||
| myfile-test-4-1.txt | 10485760 | 5242880 | 2 | | ||
| myfile-test-4-2.txt | 24117248 | 5242880 | 5 | | ||
| myfile-test-4-3.txt | 24117248 | 8388608 | 3 | | ||
|
||
Scenario Outline: Does single object upload with custom checksum | ||
Given I have a file with name <filename> and its content is <content> | ||
When I upload this file with name <filename> by providing a custom checksum algorithm <checksum_algorithm> | ||
Then the checksum from the object with name <filename> should be equals to the calculation of the object content with the checksum algorithm <checksum_algorithm> | ||
Examples: | ||
| filename | content | checksum_algorithm | | ||
| myfile-test-5-1.txt | This is a test file content #1 | crc32 | | ||
| myfile-test-5-2.txt | This is a test file content #2 | crc32c | | ||
| myfile-test-5-3.txt | This is a test file content #3 | sha256 | | ||
| myfile-test-5-4.txt | This is a test file content #4 | sha1 | | ||
|
||
Scenario Outline: Does single object download | ||
Given I have an object in S3 with name <filename> and its content is <content> | ||
When I do a download of the object with name <filename> | ||
Then the object with name <filename> should have been downloaded and its content should be <content> | ||
Examples: | ||
| filename | content | | ||
| myfile-test-6-1.txt | This is a test file content #1 | | ||
| myfile-test-6-2.txt | This is a test file content #2 | | ||
| myfile-test-6-3.txt | This is a test file content #3 | | ||
|
||
Scenario Outline: Successfully does multipart object download | ||
Given I have an object in S3 with name <filename> and its size is <filesize> | ||
When I download the object with name <filename> by using the <download_type> multipart download type | ||
Then the content size for the object with name <filename> should be <filesize> | ||
Examples: | ||
| filename | filesize | download_type | | ||
| myfile-test-7-1.txt | 20971520 | rangeGet | | ||
| myfile-test-7-2.txt | 28311552 | rangeGet | | ||
| myfile-test-7-3.txt | 12582912 | rangeGet | | ||
| myfile-test-7-4.txt | 20971520 | partGet | | ||
| myfile-test-7-5.txt | 28311552 | partGet | | ||
| myfile-test-7-6.txt | 12582912 | partGet | | ||
|
||
Scenario Outline: Successfully does directory upload | ||
Given I have a directory <directory> with <numfile> files that I want to upload | ||
When I upload this directory <directory> | ||
Then the files from this directory <directory> where its count should be <numfile> should exist in the bucket | ||
Examples: | ||
| directory | numfile | | ||
| directory-test-1-1 | 10 | | ||
| directory-test-1-2 | 3 | | ||
| directory-test-1-3 | 25 | | ||
| directory-test-1-4 | 1 | | ||
|
||
Scenario Outline: Successfully does a directory download | ||
Given I have a total of <numfile> objects in a bucket prefixed with <directory> | ||
When I download all of them into the directory <directory> | ||
Then the objects <numfile> should exist as files within the directory <directory> | ||
Examples: | ||
| numfile | directory | | ||
| 15 | directory-test-2-1 | | ||
| 12 | directory-test-2-2 | | ||
| 1 | directory-test-2-3 | | ||
| 30 | directory-test-2-4 | | ||
|
||
Scenario Outline: Abort a multipart upload | ||
Given I am uploading the file <file> with size <size> | ||
When I upload the file <file> using multipart upload and fails at part number <partNumberFail> | ||
Then The multipart upload should have been aborted for file <file> | ||
Examples: | ||
| file | size | partNumberFail | | ||
| abort-file-1.txt | 1024 * 1024 * 20 | 3 | | ||
| abort-file-2.txt | 1024 * 1024 * 40 | 5 | | ||
| abort-file-3.txt | 1024 * 1024 * 10 | 1 | |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Aws\S3\S3Transfer\Exceptions; | ||
|
||
class ProgressTrackerException extends \RuntimeException | ||
stobrien89 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
{ | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Aws\S3\S3Transfer\Exceptions; | ||
|
||
class S3TransferException extends \RuntimeException | ||
stobrien89 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
{ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Aws\S3\S3Transfer\Models; | ||
|
||
class DownloadDirectoryResponse | ||
|
||
{ | ||
/** @var int */ | ||
private int $objectsDownloaded; | ||
|
||
/** @var int */ | ||
private int $objectsFailed; | ||
|
||
/** | ||
* @param int $objectsUploaded | ||
* @param int $objectsFailed | ||
*/ | ||
public function __construct(int $objectsUploaded, int $objectsFailed) | ||
{ | ||
$this->objectsDownloaded = $objectsUploaded; | ||
$this->objectsFailed = $objectsFailed; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getObjectsDownloaded(): int | ||
{ | ||
return $this->objectsDownloaded; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getObjectsFailed(): int | ||
{ | ||
return $this->objectsFailed; | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return sprintf( | ||
"DownloadDirectoryResponse: %d objects downloaded, %d objects failed", | ||
$this->objectsDownloaded, | ||
$this->objectsFailed | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace Aws\S3\S3Transfer\Models; | ||
|
||
use Psr\Http\Message\StreamInterface; | ||
|
||
class DownloadResponse | ||
{ | ||
/** | ||
* @param StreamInterface $data | ||
* @param array $metadata | ||
*/ | ||
public function __construct( | ||
private readonly StreamInterface $data, | ||
private readonly array $metadata = [] | ||
) {} | ||
|
||
/** | ||
* @return StreamInterface | ||
*/ | ||
public function getData(): StreamInterface | ||
{ | ||
return $this->data; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getMetadata(): array | ||
{ | ||
return $this->metadata; | ||
} | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it also be possible to rename to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would be the use case for UploadDirectoryResult to extend Aws\Result? Right now this class just has two counting properties, one for successful uploads and one for failed uploads. Like: class UploadDirectoryResult {
int $failedUploads;
int $successfulUploads;
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace Aws\S3\S3Transfer\Models; | ||
|
||
class UploadDirectoryResponse | ||
yenfryherrerafeliz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
{ | ||
/** @var int */ | ||
private int $objectsUploaded; | ||
|
||
/** @var int */ | ||
private int $objectsFailed; | ||
|
||
/** | ||
* @param int $objectsUploaded | ||
* @param int $objectsFailed | ||
*/ | ||
public function __construct(int $objectsUploaded, int $objectsFailed) | ||
{ | ||
$this->objectsUploaded = $objectsUploaded; | ||
$this->objectsFailed = $objectsFailed; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getObjectsUploaded(): int | ||
{ | ||
return $this->objectsUploaded; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getObjectsFailed(): int | ||
{ | ||
return $this->objectsFailed; | ||
} | ||
} |
yenfryherrerafeliz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Aws\S3\S3Transfer\Models; | ||
|
||
class UploadResponse | ||
{ | ||
private array $uploadResponse; | ||
|
||
/** | ||
* @param array $uploadResponse | ||
*/ | ||
public function __construct(array $uploadResponse) | ||
{ | ||
$this->uploadResponse = $uploadResponse; | ||
} | ||
|
||
public function getUploadResponse(): array | ||
{ | ||
return $this->uploadResponse; | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.