Migrate to AsyncStreaming from swift-async-algorithms#160
Conversation
There was a problem hiding this comment.
Intention is to move this over to swift-async-algorithms in a subsequent PR.
There was a problem hiding this comment.
Intention is to move this over to swift-async-algorithms in a subsequent PR.
| @_exported public import HTTPAPIs | ||
|
|
||
| #if canImport(Darwin) || os(Linux) | ||
| public import BasicContainers |
There was a problem hiding this comment.
Will BasicContainers and UniqueArray move to the stdlib at some point? Would this prevent putting the API in the SDK?
There was a problem hiding this comment.
Yes they will. My hope is that InputSpan/OutputSpan will conform to RangeReplaceableContainer themselves and would allow us to not have a concrete type at all for this. Otherwise we will most likely want to use the default bag of bytes type that the stdlib folks decide. Could be either Data or UniqueData or something else.
| ) async throws(AsyncStreaming.EitherError<any Error, Failure>) -> Return where Failure: Error { | ||
| let data: Data? | ||
| do { | ||
| data = try await self.actual.data(maximumCount: nil) |
There was a problem hiding this comment.
Will there be a read with a limit in the future? The code was complex and tricky to get right, so would be great if we can get rid of it completely
There was a problem hiding this comment.
The reason that I removed the read limit is that it becomes essentially impossible to implement with containers unless containers are self-slicing.
guoye-zhang
left a comment
There was a problem hiding this comment.
The change looks fine, though it is unfortunate that we are incurring an extra copy on both the reading side and the writing side. Let's land it first.
Motivation
The
AsyncStreamingmodule here was only a temporary for us to get the API proposals up and running. We knew that this is not the final destination. I moved them over toswift-async-algorithmsthis week.Modifications
This PR migrates all towards the new
AsyncStreamingmodule that is based onRangeReplaceableContainer. Since this touches everything in this repo the changes are quite large. I broke them down into individual commits that can be reviewed in isolation.A few important things to call out:
HTTPAPIsmodule. I intend to follow up on them and make them HTTP specific.HTTPAPIsmodule. I intend to move them over to swift-async-algorithms in a subsequent PR.Result
We are now using the new
AsyncStreamingmodule fromswift-async-algorithms