feat(client): stream ParallelGet in-order to an io.Writer#360
Draft
worstell wants to merge 1 commit into
Draft
Conversation
ParallelGet previously wrote chunks to an io.WriterAt, which requires a seekable destination (e.g. a temp file) and so prevents a consumer from overlapping the download with processing. It now fetches chunks in parallel but emits in-order bytes to a plain io.Writer via a bounded reorder buffer, letting a streaming consumer (e.g. a decompress/extract pipeline) run concurrently with the download. A concurrency-sized window caps fetched-but-unwritten chunks, bounding peak memory to O(concurrency * chunkSize) regardless of object size or consumer speed. Revision safety (ETag pinning via If-Range), empty-object handling, range-ignore degrade, and the concurrency==1 shortcut are unchanged. Amp-Thread-ID: https://ampcode.com/threads/T-019ef6a9-a407-7389-bc43-001405e3ae9e Co-authored-by: Amp <amp@ampcode.com>
4d97fb3 to
83e3e16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ParallelGetpreviously wrote chunks to anio.WriterAt, which requires a seekable destination (e.g. a temp file) and so prevents a consumer from overlapping the download with processing. It now fetches chunks in parallel but emits in-order bytes to a plainio.Writervia a bounded reorder buffer, letting a streaming consumer (e.g. a decompress/extract pipeline) run concurrently with the download.A
concurrency-sized window caps fetched-but-unwritten chunks, bounding peak memory toO(concurrency * chunkSize)regardless of object size or consumer speed. Revision safety (ETag pinning viaIf-Range), empty-object handling, range-ignore degrade, and theconcurrency == 1shortcut are unchanged.This is a single API: the
io.WriterAtvariant is removed (it had no consumer that benefited from scatter-writes, and the only use — download-to-temp-file then extract — is slower than streaming because it gives up download/extract overlap).