Skip to content

feat: Resumable Media Upload functionality implementation - #72

Open
viacheslav-rostovtsev wants to merge 18 commits into
googleapis:mainfrom
viacheslav-rostovtsev:dev/virost/resumable-uploads
Open

viacheslav-rostovtsev wants to merge 18 commits into
googleapis:mainfrom
viacheslav-rostovtsev:dev/virost/resumable-uploads

Conversation

@viacheslav-rostovtsev

@viacheslav-rostovtsev viacheslav-rostovtsev commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Resumable Media Upload functionality

Public API

  • Gapic::Rest::ResumableUpload::Session is the entry point.
  • Session#start for initial upload, and
  • Session#resume for resuming after error.

Also public: Progress, ResumeHandle, HasResumeHandle module, and a typed error hierarchy.

Changes to existing files:

  • StubLogger#warn
  • request-payload abridging in ClientStub so that binary upload bodies don't land in logs
  • REST_ERROR_PREFIX constant extracted in Rest::Error

Integration testing

  • against Showcase, for manual confirmation (disabled in CI). CI integration tests are planned to land in the generator.

Comment thread gapic-common/lib/gapic/rest/resumable_upload.rb Outdated
Comment thread gapic-common/lib/gapic/rest/resumable_upload/driver.rb Outdated
Comment thread gapic-common/lib/gapic/rest/resumable_upload/rules.rb
Comment thread gapic-common/lib/gapic/resumable_upload.rb Outdated
end
return [remaining, retry_policy.timeout].min if retry_policy&.timeout

remaining

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If I'm reading this right, remaining starts at the deadline set in run (by default BASE_TIMEOUT = 3_600, longer for large files, per resolve_timeout) and counts down from there. When retry_policy comes from CONTROL_PLANE_DEFAULTS/DATA_PLANE_DEFAULTS, which don't pass a timeout:, RetryPolicy#timeout falls back to DEFAULT_TIMEOUT (3600), so the cap on line 378 only brings it down to an hour.

Thus a single stalled request can block for up to an hour. Whenever the upload has an hour or less left, which is always the case for uploads under 3.5 GiB, it could fail with DeadlineExceededError instead of entering :recovery. Is that intended, or should a stalled request get a timeout short enough to enter :recovery?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is intended for now. There is a timeout pass coming when I implement the stall control protocol -- the timeouts will change for both stall control and the default-timeout versions.

Comment thread gapic-common/lib/gapic/rest/resumable_upload/errors.rb
Public API
`Gapic::Rest::ResumableUpload::Session` is the entry point.
`Session#run` for initial upload, and `Session#resume` for resuming
after error.

Also public: `Progress`, `ResumeHandle`, `HasResumeHandle` module, and a typed error hierarchy.

Changes to existing files:
* `StubLogger#warn`
* request-payload abridging in `ClientStub` so that binary upload bodies don't land in logs
* `REST_ERROR_PREFIX` constant extracted in Rest::Error

Integration testing against Showcase, for manual confirmation (disabled in CI).
CI integration tests are planned to land in the generator.
…replacement

Show the coordinator alongside the driver in the architecture and test-plan diagrams.
…ble in driver_test

Replaces the core.instance_variable_set poke with a Core double passed through the designed test seam.
…ries from it

Comparing readers against a pristine policy dropped a caller's setting whenever it happened to equal the library default. #overrides reports only what was explicitly supplied, so start_retry_policy_for collapses to a merge and BACKOFF_DEFAULTS goes away.
…retry predicate

Only the call timeout is now imposed unconditionally; every other setting the caller carries, including a retry predicate, reaches the initiation policy.
…ator

A Showcase test that builds a Driver by hand exercises a path no generated client takes. All five suites now drive ::Gapic::ResumableUpload, build_config is gone, and the golden path gains a decode-into-a-message case.
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.

5 participants