-
Notifications
You must be signed in to change notification settings - Fork 479
R2-3560: Implement ListParts and ListMultipartUploads for R2 Binding
#5596
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: main
Are you sure you want to change the base?
Conversation
|
|
||
| KJ_IF_SOME(o, options) { | ||
| KJ_IF_SOME(l, o.limit) { | ||
| listBuilder.setLimit(l); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ListMultipartUploads should replicate the same validation logic we have for ListObjects I believe to be fully compliant with S3.
JSG_REQUIRE(l >= 1 && l <= 1000, RangeError,....
| kj::StringPtr components[1]; | ||
| auto path = fillR2Path(components, this->bucket->adminBucket); | ||
| CompatibilityFlags::Reader flags = {}; | ||
| auto promise = doR2HTTPGetRequest(kj::mv(client), kj::mv(requestJson), path, kj::none, flags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm missing something, but wouldn't this fail if you are explicitly passing in kj::none instead of the JWT?
| } | ||
|
|
||
| struct R2ListMultipartUploadsRequest { | ||
| limit @0 :UInt32 = 0xffffffff; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I am just being paranoid, but would a more sensible default here make more sense (i.e AWS S3 defaults for max values?). IIRC 1000
| } | ||
| KJ_IF_SOME(p, o.partNumberMarker) { | ||
| JSG_REQUIRE( | ||
| p >= 0, RangeError, "partNumberMarker must be non-negative. Actual value was: ", p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is subtle and I learned this recently myself, but the part numbers are 1-indexed so this conditional is bugged since it needs to be strictly greater than.
| { | ||
| partNumber: 1, | ||
| etag: 'partEtag1', | ||
| size: '100', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we treating size as a string? (Sorry I am no C++/kj expert so maybe it's normal, but it seems a bit odd)
| key: string; | ||
| uploadId: string; | ||
| initiated?: Date; | ||
| storageClass?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe strongly type the storage class with a default?
First pass, may need polishing.