Skip to content

Error-erasing StorageSequence and demand test - #12

Merged
viaszkadi merged 3 commits into
mainfrom
feature/chunks
Sep 16, 2026
Merged

viaszkadi merged 3 commits into
mainfrom
feature/chunks

Conversation

@viaszkadi

Copy link
Copy Markdown
Contributor

Replace the AsyncStream<Result<ByteBuffer, any Error>> wrapper with a small ErrorErasingSequence that erases the failure type, simplifying StorageSequence internals and iterator typing (uses any AsyncIteratorProtocol/any AsyncSequence). This removes the Result wrapping and stream machinery while preserving behavior. Add a unit test (DemandProbe + DemandTrackingSequence) that verifies StorageSequence only requests upstream elements when the consumer advances (demand-driven).

Replace the AsyncStream<Result<ByteBuffer, any Error>> wrapper with a small ErrorErasingSequence that erases the failure type, simplifying StorageSequence internals and iterator typing (uses any AsyncIteratorProtocol/any AsyncSequence). This removes the Result wrapping and stream machinery while preserving behavior. Add a unit test (DemandProbe + DemandTrackingSequence) that verifies StorageSequence only requests upstream elements when the consumer advances (demand-driven).
@viaszkadi
viaszkadi requested a review from tib September 15, 2026 15:20
StorageSequence was retaining a single base async sequence, which could reuse iterator state across calls. This change creates a fresh iterator per makeAsyncIterator invocation while preserving the existing error-erased sequence behavior.
Comment thread Sources/FeatherStorage/StorageSequence.swift Outdated
This change renames the internal StorageSequence wrapper from ErrorErasingSequence to FailureErasingAsyncSequence to better reflect its purpose. The sequence still erases failure types while preserving byte-buffer output, keeping the StorageSequence API behavior unchanged.
@viaszkadi
viaszkadi merged commit bf6d985 into main Sep 16, 2026
28 checks passed
@viaszkadi
viaszkadi deleted the feature/chunks branch September 16, 2026 09:51
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