Skip to content

feat(gax): add ResumableUploadCallable and ResumableUploadCallSettings - #14052

Merged
blakeli0 merged 1 commit into
googleapis:mainfrom
blakeli0:feat/gax-resumable-upload-public-api
Aug 14, 2026
Merged

feat(gax): add ResumableUploadCallable and ResumableUploadCallSettings#14052
blakeli0 merged 1 commit into
googleapis:mainfrom
blakeli0:feat/gax-resumable-upload-public-api

Conversation

@blakeli0

@blakeli0 blakeli0 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

This PR introduces the foundational GAX Public API surface for HTTP/JSON resumable uploads.

Changes

  1. ResumableUploadCallable: Transport-agnostic class with futureCall(request, payload, settings) and resumeCall(sessionUrl, payload, settings) returning ResumableUploadFuture<ResponseT>.
  2. ResumableUploadFuture: Specialized ApiFuture<ResponseT> interface for active session inspection (getUploadSessionUrl()) and cancellation control.
  3. ResumableUploadCallSettings: Non-generic @AutoValue configuration class with merge(other) method and chunkSize = 8MB default.
  4. ResumableUploadCallSettingsTest: JUnit 5 (Jupiter) unit tests verifying default chunk boundaries and merge(other) overrides.

@blakeli0
blakeli0 requested review from a team as code owners August 12, 2026 05:55

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the ResumableUploadCallSettings and ResumableUploadCallable classes to support transport-independent resumable uploads, along with associated unit tests. The review feedback suggests adding input validation to ensure chunkSize is positive and totalBytes is non-negative, as well as removing several redundant null casts in the overloaded call and futureCall methods to clean up the code.

Comment on lines +76 to +79
public ApiFuture<ResponseT> futureCall(RequestT request, InputStream payload) {
return futureCall(
request, payload, (ResumableUploadCallSettings<RequestT, ResponseT>) null, (ApiCallContext) null);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The casts (ResumableUploadCallSettings<RequestT, ResponseT>) null and (ApiCallContext) null are redundant because there is only one 4-argument overload of futureCall. Removing them simplifies the code and improves readability.

  public ApiFuture<ResponseT> futureCall(RequestT request, InputStream payload) {
    return futureCall(request, payload, null, null);
  }

@blakeli0
blakeli0 force-pushed the feat/gax-resumable-upload-public-api branch 9 times, most recently from c52d225 to 2cf5521 Compare August 12, 2026 06:34

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to also provide a version that accepts something like a supplier/provider of InputStream?

An addition could probably be in a subsequent PR but I'm curious what your thinking is on the concept. IIUC, since most InputStream implementations aren't seekable/resetable (this notably includes FileInputStream) this could be useful for error recovery.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to also provide a version that accepts something like a supplier/provider of InputStream?

I think it is a good idea. But I would prefer to use the native InputStream if it already meets all the use cases.

Regarding seek-ability, FileInputStream does support skipping over bytes? It does not support resetting but I don't think we need to reset a stream either?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right - since we'll be buffering each chunk until complete receipt is confirmed by the server we shouldn't need to rewind or reset. So skip-ability should suffice.

@blakeli0
blakeli0 force-pushed the feat/gax-resumable-upload-public-api branch 2 times, most recently from 21df0c9 to 742f627 Compare August 13, 2026 06:34
…sumableUploadCallSettings

Add ResumableUploadFuture interface for active upload session URL tracking and cancellation. Update ResumableUploadCallable to return ResumableUploadFuture and include resumeCall(sessionUrl, payload, settings).
@blakeli0
blakeli0 force-pushed the feat/gax-resumable-upload-public-api branch from 742f627 to 04f55d0 Compare August 14, 2026 06:55
@blakeli0
blakeli0 merged commit a5e26e8 into googleapis:main Aug 14, 2026
299 of 303 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants