2 Commits
Author SHA1 Message Date
George BarnettandCory Benfield cde820ed39 Make HTTP2StreamChannel generic over a message type (#218)
Motivation:

As part of #214 we need to make `HTTP2StreamChannel` generic over the type
of message it expects to read and write. This allows us to define an
`HTTP2StreamChannel` which uses `HTTP2Frame.FramePayload` as its
currency type, rather than `HTTP2Frame`.

Modifications:

- Make `HTTP2StreamChannel` generic over `Message` which is constrained
  by conformance to `HTTP2FrameConvertible` and
  `HTTP2FramePayloadConvertible`
- `HTTP2StreamChannel` now expects to read in `Message`s (as opposed to
  `HTTP2Frame`s) and have `Message`s written in to it.
- Added typealiases for frame and payload based stream channels.
- Added support for the payload based channel in
  `MultiplexerAbstractChannel` (although one can't be created yet).

Result:

We can create payload based stream channels.

Co-authored-by: Cory Benfield <lukasa@apple.com>
2020-07-29 13:04:53 +01:00
George Barnett 7b0faab2de Add HTTP2FrameConvertible and HTTP2FramePayloadConvertible (#216)
Motivation:

As part of the work for #214 to enforce stream creation order we need to
remove the requirement that the data sent over the stream be aware of
its stream ID ahead of time. This requires that the channel transporting
the data provide the stream ID. As such we need a way to convert between
data with stream IDs and data without stream IDs.

Modifications:

- Add 'HTTP2FrameConvertible' protocol whose conforming types can make
  an 'HTTP2Frame'.
- Add 'HTTP2FramePayloadConvertible' protocol whose conforming types can make
  an 'HTTP2Frame.FramePayload'.
- Conform 'HTTP2Frame' and 'HTTP2Frame.FramePayload' to the above
  protocols.

Result:

We have a protocol which an HTTP2 stream channel may be generic over.
2020-07-28 14:16:19 +01:00