Skip to content
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

Feat S3 Transfer Manager v2 GetObject/DownloadObject #2996

Merged
merged 38 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fb0d69c
Feat s3 transfer manager v2 PutObject (#2733)
wty-Bryant Nov 7, 2024
c603746
move transfer manager v2 integration tests to within module (#2987)
lucix-aws Jan 28, 2025
453f02e
draft apis for downloader
Nov 14, 2024
74543bc
commit changes for now
Nov 15, 2024
5a37f78
draft commit
Nov 19, 2024
1b2f596
draft commit
Nov 26, 2024
3452a15
draft commit
Nov 27, 2024
fd0c1a3
draft commit
Dec 3, 2024
25fa0ed
draft commit
Dec 4, 2024
2a64e88
draft code for downloader
Dec 18, 2024
eacaa9b
draft code of test
Dec 23, 2024
b3aef11
draft code for getobject test
wty-Bryant Dec 24, 2024
e958754
add draft downloader unit test
wty-Bryant Jan 6, 2025
92867ab
update getobject test
wty-Bryant Jan 7, 2025
1a71fbc
update getobject tests
wty-Bryant Jan 10, 2025
c74c5fc
update getobject test
wty-Bryant Jan 13, 2025
a159886
update getobject test
wty-Bryant Jan 16, 2025
6d31bec
draft code
wty-Bryant Jan 27, 2025
0a831d9
draft code
wty-Bryant Jan 27, 2025
4b4c32d
draft code
wty-Bryant Jan 28, 2025
6b4b191
fix chunk writer issue
wty-Bryant Jan 29, 2025
193d5a5
add integ test for getobject
wty-Bryant Jan 30, 2025
393a1e8
add default checksum behavior to putobject
wty-Bryant Jan 30, 2025
0eebee6
add default checksum behavior to getobject
wty-Bryant Jan 31, 2025
0bc6f12
remove unrelated go mod change
wty-Bryant Jan 31, 2025
72ee5a6
add comment for exported func and type
wty-Bryant Jan 31, 2025
3d1be5d
add comment for exported type
wty-Bryant Jan 31, 2025
259bb70
change comment and remove extra error unwrap func
wty-Bryant Feb 3, 2025
87e6871
incomplete draft code
wty-Bryant Feb 7, 2025
cfb1a3b
split downloader and getter
wty-Bryant Feb 13, 2025
faad5de
add concurrent reader
wty-Bryant Mar 10, 2025
7d30a68
implement concurrent reader for getobject
wty-Bryant Mar 12, 2025
9512024
add comment
wty-Bryant Mar 12, 2025
b84f716
add test client comment
wty-Bryant Mar 12, 2025
24204c3
fix some testing error syntax
wty-Bryant Mar 12, 2025
bae8833
change some data race code
wty-Bryant Mar 12, 2025
b8c1530
defer close single download response body
wty-Bryant Mar 14, 2025
684ca8e
change max call
wty-Bryant Mar 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions feature/s3/transfermanager/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ type S3APIClient interface {
CreateMultipartUpload(context.Context, *s3.CreateMultipartUploadInput, ...func(*s3.Options)) (*s3.CreateMultipartUploadOutput, error)
CompleteMultipartUpload(context.Context, *s3.CompleteMultipartUploadInput, ...func(*s3.Options)) (*s3.CompleteMultipartUploadOutput, error)
AbortMultipartUpload(context.Context, *s3.AbortMultipartUploadInput, ...func(*s3.Options)) (*s3.AbortMultipartUploadOutput, error)
GetObject(context.Context, *s3.GetObjectInput, ...func(*s3.Options)) (*s3.GetObjectOutput, error)
HeadObject(context.Context, *s3.HeadObjectInput, ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
}
7 changes: 7 additions & 0 deletions feature/s3/transfermanager/api_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const defaultMultipartUploadThreshold = 1024 * 1024 * 16
// using PutObject().
const defaultTransferConcurrency = 5

const defaultPartBodyMaxRetries = 3

const defaultGetBufferSize = 1024 * 1024 * 50

// Client provides the API client to make operations call for Amazon Simple
// Storage Service's Transfer Manager
// It is safe to call Client methods concurrently across goroutines.
Expand All @@ -39,6 +43,9 @@ func New(s3Client S3APIClient, opts Options, optFns ...func(*Options)) *Client {
resolvePartSizeBytes(&opts)
resolveChecksumAlgorithm(&opts)
resolveMultipartUploadThreshold(&opts)
resolveGetObjectType(&opts)
resolvePartBodyMaxRetries(&opts)
resolveGetBufferSize(&opts)

return &Client{
options: opts,
Expand Down
874 changes: 874 additions & 0 deletions feature/s3/transfermanager/api_op_DownloadObject.go

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions feature/s3/transfermanager/api_op_DownloadObject_integ_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//go:build integration
// +build integration

package transfermanager

import (
"bytes"
"github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager/types"
"strings"
"testing"
)

func TestInteg_DownloadObject(t *testing.T) {
cases := map[string]getObjectTestData{
"part get seekable body": {Body: strings.NewReader("hello world"), ExpectBody: []byte("hello world")},
"part get empty string body": {Body: strings.NewReader(""), ExpectBody: []byte("")},
"part get multipart body": {Body: bytes.NewReader(largeObjectBuf), ExpectBody: largeObjectBuf},
"range get seekable body": {
Body: strings.NewReader("hello world"),
ExpectBody: []byte("hello world"),
OptFns: []func(*Options){
func(opt *Options) {
opt.GetObjectType = types.GetObjectRanges
},
},
},
"range get empty string body": {
Body: strings.NewReader(""),
ExpectError: "InvalidRange",
OptFns: []func(*Options){
func(opt *Options) {
opt.GetObjectType = types.GetObjectRanges
},
},
},
"range get multipart body": {
Body: bytes.NewReader(largeObjectBuf),
ExpectBody: largeObjectBuf,
OptFns: []func(*Options){
func(opt *Options) {
opt.GetObjectType = types.GetObjectRanges
},
},
},
}

for name, c := range cases {
t.Run(name, func(t *testing.T) {
testDownloadObject(t, setupMetadata.Buckets.Source.Name, c)
})
}
}
Loading