feat(gax): implement uploadChunkCallable for resumable uploads - #14140
feat(gax): implement uploadChunkCallable for resumable uploads#14140whowes wants to merge 1 commit into
Conversation
faf99d0 to
010c0aa
Compare
010c0aa to
baee7f0
Compare
|
/gemini review |
baee7f0 to
8a6d2fc
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces support for transmitting individual chunks in a resumable upload session by adding ChunkUploadRequest and ChunkUploadResponse classes, implementing uploadChunkCallable() in HttpJsonResumableUploadClient, and adding corresponding unit tests. Feedback was provided to change the HTTP method in UPLOAD_CHUNK_DESCRIPTOR from POST to PUT to comply with the Google Scotty resumable upload protocol.
8a6d2fc to
1c123a9
Compare
|
1c123a9 to
d1a4963
Compare
d1a4963 to
0dcb287
Compare
839a11f to
e6fd648
Compare
e6fd648 to
c851386
Compare
c851386 to
3e9ab99
Compare
3e9ab99 to
4937751
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces chunk uploading capabilities to the resumable upload client by adding ChunkUploadRequest and ChunkUploadResponse value objects, exposing uploadChunkCallable() in ResumableUploadClient, and implementing it in HttpJsonResumableUploadClient along with corresponding unit tests. The review feedback suggests optimizing memory efficiency by using InputStreamContent instead of ByteArrayContent for payload transmission, replacing Guava's Strings.isNullOrEmpty with standard Java checks, and adding defensive validation to ensure non-negative offsets during object creation.
|
|
||
| String sizeReceivedStr = | ||
| HttpHeadersUtils.getFirstHeader(headers, UPLOAD_SIZE_RECEIVED_HEADER); | ||
| if (!Strings.isNullOrEmpty(sizeReceivedStr)) { |
There was a problem hiding this comment.
Using a standard null and empty check avoids any dependency on the Strings class from Guava, ensuring compatibility and avoiding potential compilation issues if the import is missing.
| if (!Strings.isNullOrEmpty(sizeReceivedStr)) { | |
| if (sizeReceivedStr != null && !sizeReceivedStr.isEmpty()) { |
4937751 to
a3f0d4c
Compare
|
|







This handles sending binary chunks and finalize commands over HTTP/JSON, extracting offset and status from response headers/codes.