Skip to content

feat(storage)!: retry loop for downloads - #469

Merged
chingor13 merged 2 commits into
googleapis:mainfrom
chingor13:resumable-download
Aug 18, 2026
Merged

feat(storage)!: retry loop for downloads#469
chingor13 merged 2 commits into
googleapis:mainfrom
chingor13:resumable-download

Conversation

@chingor13

Copy link
Copy Markdown
Contributor

Implements retry loop for download

The metadata is returned on the initial request so we want this part of the retry loop. Therefore, we change when the user calls await.

Metadata reading:

let download = storageClient.readObject(from: "my-bucket", object: "large-file.bin")
let metadata = try await download.metadata
print("Size: \(metadata.size) bytes, Generation: \(metadata.generation)")

Data reading:

let download = storageClient.readObject(from: "my-bucket", object: "large-file.bin")
for try await chunk in download.body {
  processChunk(chunk)
}

Since the metadata fetching and data stream are in the same request, we use a coordinator to manage the RPC call.

@chingor13 chingor13 changed the title feat(storage)!: make initial read object request and retries async feat(storage)!: retry loop for downloads Aug 18, 2026

@coryan coryan 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.

Nothing blocking, though maybe the behavior when the service returns more data than expected should be to return an error?

Comment thread packages/storage/Sources/GoogleCloudStorage/DownloadOptions.swift
Comment thread packages/storage/Sources/GoogleCloudStorage/DownloadOptions.swift
Comment thread packages/storage/Sources/GoogleCloudStorage/DownloadOptions.swift
@chingor13
chingor13 marked this pull request as ready for review August 18, 2026 23:05
@chingor13
chingor13 requested a review from a team as a code owner August 18, 2026 23:05
@chingor13
chingor13 enabled auto-merge (squash) August 18, 2026 23:06
@chingor13
chingor13 merged commit eea314e into googleapis:main Aug 18, 2026
23 of 24 checks passed
@chingor13
chingor13 deleted the resumable-download branch August 18, 2026 23:08
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