You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update README.md
* Add memory manager and memory managemenet for downloadObject and uploadObject.
* Increase file descriptor for linux ubuntu environment in GH actions.
* Correct comments on maxInMemoryBytes config option & limit memory limit for concurrentDownload integration test.
* Try lower maxInMemoryBytes to appease GH CI environments.
* If this doesn't work, change approach to batch memory mgmt.
* Remove changes that didn't fix concurrent download test failure for linux.
* Refactor memory mgmt to batch based for downloads.
* Fix concurrent download integ test to use range download type. Also, add conversion method to download object to remove reference to body from triage getObject outputs.
* Try adding retry to writeData, see if that addresses issue in Linux.
* Revert "Try adding retry to writeData, see if that addresses issue in Linux."
This reverts commit ffe4bd8.
* Try increasing file descriptor again.
* Slightly change how writeData is done & add logging for bytes written.
* Add more liux CI cases.
* Disable integ tests that use symlink for linux because symlink resolution behavior in linux differs between versions.
* Limit maxConections to see if it resolves stream request timeout issue during download step in DirectoryTransferIntegrationTests.swift.
* Add a withMemoryPermission() helper function to avoid calling waitForMemory() and releaseMemory() directly from transfer logic. Add documentation comments for errors thrown by each operation & remove no longer used ones. Modify default maxInMemoryBytes values for iOS, tvOS, and watchOS.
---------
Co-authored-by: Sichan Yoo <chanyoo@amazon.com>
Copy file name to clipboardExpand all lines: README.md
+15-45Lines changed: 15 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ Or you could pass the config object to the initializer to customize S3TM by doin
70
70
```swift
71
71
// Create the custom S3 client config that you want S3TM to use.
72
72
let customS3ClientConfig =try S3Client.S3ClientConfiguration(
73
-
region: "some-region",
73
+
region: "us-west-2",
74
74
. . . custom S3 client configurations . . .
75
75
)
76
76
@@ -92,27 +92,24 @@ For more information on what each configuration does, please refer to [the docum
92
92
93
93
### Upload an object
94
94
95
-
To upload a file to Amazon S3, you need to provide the input struct UploadObjectInput, which contains a subset of PutObjectInput struct properties and an array of TransferListener. You must provide the destination bucket, the S3 object key to use, and the object body.
95
+
To upload a file to Amazon S3, you need to provide the input struct `UploadObjectInput`, which contains a subset of `PutObjectInput` struct properties and an array of transfer listeners. You must provide the destination bucket, the S3 object key to use, and the object body.
96
96
97
97
When object being uploaded is bigger than the threshold configured by `multipartUploadThresholdBytes` (16MB default), S3TM breaks them down into parts, each with the part size configured by `targetPartSizeBytes` (8MB default), and uploads them concurrently using S3’s [multipart upload feature](https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html#mpu-process).
let uploadObjectTask =try s3tm.uploadObject(input: uploadObjectInput)
114
111
115
-
// Optional: await on the returned task and retrieve the operation output or an error.
112
+
// Optional for every transfer operation: await on the returned task and retrieve the operation output or an error.
116
113
// Even if you don't do this, the task executes in the background.
117
114
do {
118
115
let uploadObjectOutput =tryawait uploadObjectTask.value
@@ -123,13 +120,11 @@ do {
123
120
124
121
### Download an object
125
122
126
-
To download an object from Amazon S3, you need to provide the input struct DownloadObjectInput, which contains the download destination, a subset of GetObjectInput struct properties, and an array of TransferListener. The download destination is an instance of [Swift’s Foundation.OutputStream](https://developer.apple.com/documentation/foundation/outputstream). You must provide the download destination, the source bucket, and the S3 object key of the object to download.
123
+
To download an object from Amazon S3, you need to provide the input struct `DownloadObjectInput`, which contains the download destination, a subset of `GetObjectInput` struct properties, and an array of transfer listeners. The download destination is an instance of [Swift’s Foundation.OutputStream](https://developer.apple.com/documentation/foundation/outputstream). You must provide the download destination, the source bucket, and the S3 object key of the object to download.
127
124
128
125
When object being downloaded is bigger than the size of a single part configured by `targetPartSizeBytes` (8MB default), S3TM downloads the object in parts concurrently using either part numbers or byte ranges as configured by `multipartDownloadType` (`.part` default).
@@ -139,25 +134,16 @@ let downloadObjectInput = DownloadObjectInput(
139
134
140
135
// Call .downloadObject and save the returned task.
141
136
let downloadObjectTask =try s3tm.downloadObject(input: downloadObjectInput)
142
-
143
-
// Optional: await on the returned task and retrieve the operation output or an error.
144
-
// Even if you don't do this, the task executes in the background.
145
-
do {
146
-
let downloadObjectOutput =tryawait downloadObjectTask.value
147
-
} catch {
148
-
// Handle error.
149
-
}
137
+
let downloadObjectOutput =tryawait downloadObjectTask.value
150
138
```
151
139
152
140
### Upload a directory
153
141
154
-
To upload a local directory to a S3 bucket, you need to provide the input struct UploadDirectoryInput and provide the destination bucket, and the source directory’s URL.
142
+
To upload a local directory to a S3 bucket, you need to provide the input struct `UploadDirectoryInput` and provide the destination bucket, and the source directory’s URL.
155
143
156
-
The UploadDirectoryInput struct has several optional properties that configure the transfer behavior. For more details on what each input configuration does, refer to [the documentation comments on the UploadDirectoryInput](https://github.com/aws/aws-sdk-swift-s3-transfer-manager/blob/main/Sources/S3TransferManager/Model/OperationInput/UploadDirectoryInput.swift).
144
+
The `UploadDirectoryInput` struct has several optional properties that configure the transfer behavior. For more details on what each input configuration does, refer to [the documentation comments on the UploadDirectoryInput](https://github.com/aws/aws-sdk-swift-s3-transfer-manager/blob/main/Sources/S3TransferManager/Model/OperationInput/UploadDirectoryInput.swift).
157
145
158
146
```swift
159
-
let s3tm =tryawaitS3TransferManager()
160
-
161
147
// Construct UploadDirectoryInput.
162
148
let uploadDirectoryInput =tryUploadDirectoryInput(
163
149
bucket: "destination-bucket",
@@ -166,25 +152,16 @@ let uploadDirectoryInput = try UploadDirectoryInput(
166
152
167
153
// Call .uploadDirectory and save the returned task.
168
154
let uploadDirectoryTask =try s3tm.uploadDirectory(input: uploadDirectoryInput)
169
-
170
-
// Optional: await on the returned task and retrieve the operation output or an error.
171
-
// Even if you don't do this, the task executes in the background.
172
-
do {
173
-
let uploadDirectoryOutput =tryawait uploadDirectoryTask.value
174
-
} catch {
175
-
// Handle error.
176
-
}
155
+
let uploadDirectoryOutput =tryawait uploadDirectoryTask.value
177
156
```
178
157
179
158
### Download a bucket
180
159
181
-
To download a S3 bucket to a local directory, you need to provide the input struct DownloadBucketInput and provide the source bucket, and the destination directory URL.
160
+
To download a S3 bucket to a local directory, you need to provide the input struct `DownloadBucketInput` and provide the source bucket, and the destination directory URL.
182
161
183
-
The DownloadBucketInput struct has several optional properties that configure the transfer behavior. For more details on what each input configuration does, refer to [the documentation comments on the DownloadBucketInput](https://github.com/aws/aws-sdk-swift-s3-transfer-manager/blob/main/Sources/S3TransferManager/Model/OperationInput/DownloadBucketInput.swift).
162
+
The `DownloadBucketInput` struct has several optional properties that configure the transfer behavior. For more details on what each input configuration does, refer to [the documentation comments on the DownloadBucketInput](https://github.com/aws/aws-sdk-swift-s3-transfer-manager/blob/main/Sources/S3TransferManager/Model/OperationInput/DownloadBucketInput.swift).
184
163
185
164
```swift
186
-
let s3tm =tryawaitS3TransferManager()
187
-
188
165
// Construct DownloadBucketInput.
189
166
let downloadBucketInput =DownloadBucketInput(
190
167
bucket: "source-bucket",
@@ -193,21 +170,14 @@ let downloadBucketInput = DownloadBucketInput(
193
170
194
171
// Call .downloadBucket and save the returned task.
195
172
let downloadBucketTask =try s3tm.downloadBucket(input: downloadBucketInput)
196
-
197
-
// Optional: await on the returned task and retrieve the operation output or an error.
198
-
// Even if you don't do this, the task executes in the background.
199
-
do {
200
-
let downloadBucketOutput =tryawait downloadBucketTask.value
201
-
} catch {
202
-
// Handle error.
203
-
}
173
+
let downloadBucketOutput =tryawait downloadBucketTask.value
204
174
```
205
175
206
176
### Monitor transfer progress
207
177
208
-
You can optionally configure transfer listeners for any of the S3TM operations above. The Amazon S3 Transfer Manager for Swift provides 2 canned transfer progress listeners for you. They’re LoggingTransferListeners and StreamingTransferListeners. There's a specific listener type for each operation, e.g., `UploadObjectLoggingTransferListener` is a LoggingTransferListener for the single object upload operation.
178
+
You can optionally configure transfer listeners for any of the S3TM operations above. The Amazon S3 Transfer Manager for Swift provides 2 canned transfer progress listeners for you. They’re `LoggingTransferListener`s and `StreamingTransferListener`s. There's a specific listener type for each operation, e.g., `UploadObjectLoggingTransferListener` is a `LoggingTransferListener` for the single object upload operation.
209
179
210
-
The LoggingTransferListeners log transfer events to the console using [swift-log](https://github.com/apple/swift-log). The StreamingTransferListeners publish transfer events to its AsyncThrowingStream instance property, which can be awaited on to consume and handle events as needed. You can configure any number of transfer listeners for the S3TM operations via their inputs (e.g., UploadObjectInput's `transferListeners` field). You can add your own custom transfer listeners as well, by implementing a struct or a class that conforms to the TransferListener protocol and configuring it in the input structs.
180
+
The `LoggingTransferListener`s log transfer events to the console using [swift-log](https://github.com/apple/swift-log). The `StreamingTransferListener`s publish transfer events to its `AsyncThrowingStream` instance property, which can be awaited on to consume and handle events as needed. You can configure any number of transfer listeners for the S3TM operations via their inputs (e.g., `UploadObjectInput`'s `transferListeners` field). You can add your own custom transfer listeners as well, by implementing a struct or a class that conforms to the `TransferListener` protocol and configuring it in the input structs.
211
181
212
182
See below for the example usage of the two canned transfer listeners.
213
183
@@ -233,7 +203,7 @@ let uploadObjectTask = try s3tm.uploadObject(input: uploadObjectInput)
233
203
234
204
#### StreamingTransferListener
235
205
236
-
For StreamingTransferListener, you must close the underlying AsyncThrowingStream after transfer completion by explicitly calling closeStream() on the StreamingTransferListener instance to prevent memory leaks and hanging stream consumers.
206
+
For `StreamingTransferListener`, you must close the underlying `AsyncThrowingStream` after transfer completion by explicitly calling `closeStream()` on the `StreamingTransferListener` instance to prevent memory leaks and hanging stream consumers.
0 commit comments