feat(lib-storage): S3TransferManager - #7731
Conversation
| * @internal | ||
| */ | ||
| private calculatePartSize(contentLength: number): { partSize: number; expectedPartsCount: number } { | ||
| const partSize = Math.max(this.targetPartSizeBytes, Math.floor(contentLength / 10_000)); |
There was a problem hiding this comment.
pretty sure this needs to be Math.ceil(contentLength / 10_000). check out this issue aws/aws-sdk-net#4332 you might want to add a test case for this
GarrettBeatty
left a comment
There was a problem hiding this comment.
added one comment. i can review rest of pr later if wanted
1bea79a to
8263551
Compare
7ff3777 to
31dd619
Compare
2841950 to
16d443e
Compare
| (response.Body as any).getReader = function () { | ||
| return reader; | ||
| }; | ||
| } |
There was a problem hiding this comment.
what is this override of getReader doing?
There was a problem hiding this comment.
uses the same reader instance, when stream is already locked.
There was a problem hiding this comment.
that seems dangerous and counter to the point of having a lockable stream
| private readonly eventListeners: TransferEventListeners; | ||
| private readonly abortCleanupFunctions = new WeakMap<AbortSignal, () => void>(); | ||
| private readonly maxConcurrentRequests: number; | ||
| private readonly maxConcurrentUploads: number; |
There was a problem hiding this comment.
explain the state variables.
what is targetPartSizeBytes? why is checksumAlgorithm a property of this class?
what is the difference between maxConcurrentRequests and maxConcurrentUploads?
There was a problem hiding this comment.
-
targetPartSizeBytes // Size of a part user wants to use for transfer
-
maxConcurrentRequests // This used only for downloads which determines max no of parts that can be downloaded concurrently or call it like max no of getObject requests that can be made.
-
maxConcurrentUploads // This is for upload, max no of parts that can be uploaded concurrently
There was a problem hiding this comment.
maxConcurrentRequests should be renamed. Uploads are requests too.
There was a problem hiding this comment.
renamed it to maxInMemoryParts according to specification wording
There was a problem hiding this comment.
maxInMemoryParts is misleading. Are the parts fully buffered in memory? I think not.
And it only applies to downloads?
It should be called maxConcurrentDownloads
There was a problem hiding this comment.
+1 there is two separate things. maxConcurrentDownloads (number of http requests) and maxInMemoryParts (number of parts buffered in memory) (if applicable)
There was a problem hiding this comment.
+1 to Garrett's comment. Yeah, was a bit confused here.
There was a problem hiding this comment.
Removed maxInMemoryParts for downloads because we only initiate the next request after a stream is consumed. So the number of buffered parts can't exceed maxConcurrentDownloads.
eea6c87 to
b20066e
Compare
feat(lib-storage): added doc comments for interfaces and types feat(lib-storage): address PR review feedback for transfer manager types feat(lib-storage): addressed minor review feedback feat(lib-storage): added example code file feat(lib-storage): changed "handler" to "listener" and changed type file names feat(lib-storage): created TransferManager class and constructor with defaults feat(lib-storage): beginning implementation for download(), created TM index file feat(lib-storage): range multipart download feat(lib-storage): download() improvements post pair-programming feat(lib-storage): transfermanager download() iteration feat(lib-storage): transfermanager interation post pair programming feat(lib-storage): joinstream iteration, web stream not fully functional feat(lib-storage): both cases of range download handled feat(lib-storage): range download working chore: acquire lock on streams feat(lib-storage): bug fixes and test env setup feat(lib-storage): implemented dispatchEvent(), need to add dispatches for complete and fail feat(lib-storage): requests array, eventListeners revision, needs more testing feat(lib-storage): addEventListener & removeEventListener implemented, needs support for options feat(lib-storage): added support for adding event listeners at request level feat(lib-storage): added ETag verification for subsequent GetObjectRequests feat(lib-storage): totalSize changes, and added validateExpectedRanges() feat(lib-storage): addEventListener once parameter, type fixes feat(lib-storage): s3TM SEP test cases and added TODOs feat(lib-storage): validateExpectedRanges fixes and unit tests feat(lib-storage): added check in validateExpectedRanges if final part doesnt download total object feat(lib-storage): s3TM constructor and add event listener tests feat(lib-storage): addEventListener tests and error checking adjustment and dispatchEvent tests feat(lib-storage): added test cases
0dedb30 to
3da7b90
Compare
| }, | ||
| "license": "Apache-2.0", | ||
| "dependencies": { | ||
| "@aws-sdk/config": "workspace:3.1058.0", |
There was a problem hiding this comment.
don't use internally, import the implementation pkg
kuhe
left a comment
There was a problem hiding this comment.
will be split into multiple PRs, blocking this
Issue
Internal JS-6610
Description
This PR adds upload functionality to the S3 Transfer Manager, building upon previous PR that wasn't merged. This implementation focuses specifically on single object and multipart upload capabilities commit.
Testing
Checklist
*.integ.spec.ts).@publictag and enable doc generation on the package?By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.