Skip to content

feat!: Streaming + Event Streams #542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 21, 2023
Merged

feat!: Streaming + Event Streams #542

merged 8 commits into from
Apr 21, 2023

Conversation

epau
Copy link
Contributor

@epau epau commented Apr 7, 2023

Issue #

Description of changes

Scope

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@epau epau force-pushed the 870-event-streaming-impl branch from 3be9583 to 1033de0 Compare April 7, 2023 14:37
Ganesh Jangir and others added 7 commits April 19, 2023 15:57
The SDK doesn't stream request and responses rather it buffers them in memory. This is a problem for large requests and responses.

Introduced `HttpContent` which conforms to `IStreamable` (a CRT protocol) required for streaming requests. `HttpContent` can be created from `HttpBody` which can be either a Data or a Stream.

Introduced `Stream` protocol and number of implementations for different stream types.

- `BufferedStream` - allows thread safe reading and writing while keeping only a fixed unread amount of data in memory.
- `FileStream` - allows reading and writing from/to a file.
- `CacheStream` -  allows thread safe reading and writing on base stream. This is useful for streams that don't support seeking.

Now we can stream requests and responses.
To support event streaming, SDK needs basic constructs like Encoder, Decoder, Signer and Message.

- Add `Message` and its nested types
- Add `MessageEncoder` and `MessageDecoder` protocols
- Add `MessageDecoderStream` and `MessageEncoderStream` protocols which are async streams

All these things are not AWS specific, hence they are in ClientRuntime instead of AWSClientRuntime.

Nothing in ClientRuntime.
* wip

* revert to explict header types

* add docs on http2ManualDataWrites

* make H2 behave same as H1 except manual writes

* docs

* docs and reformat

* comment

* reindent

* not neede

* bring back mocked impl

* fix test cases

* Update Sources/ClientRuntime/Networking/Http/CRT/HTTP2Stream+HttpBody.swift

Co-authored-by: Ed Paulosky <[email protected]>

* Update Sources/ClientRuntime/Networking/Streaming/BufferedStream.swift

Co-authored-by: Ed Paulosky <[email protected]>

* Update Sources/ClientRuntime/Networking/Http/CRT/HTTP2Stream+HttpBody.swift

Co-authored-by: Ed Paulosky <[email protected]>

* Update Sources/ClientRuntime/Networking/Http/CRT/CRTClientEngine.swift

Co-authored-by: Ed Paulosky <[email protected]>

* rename method

* docs

* remove whilecard import

* update branch

* Update Sources/ClientRuntime/Networking/Http/CRT/HTTP2Stream+HttpBody.swift

Co-authored-by: Ed Paulosky <[email protected]>

* fix test case

* fixed compile error

* extract ALPN setting

* empty line

* try to set Event == Element explicitly for Linux

* types

* fix context mutation

* apply ALPN for all

---------

Co-authored-by: Ganesh Jangir <[email protected]>
Co-authored-by: Ed Paulosky <[email protected]>
* WIP

* Uses http2 stream manager for bidirectional event streams

* removes print statements

* Fixes up streams

* Auto formats file

* fixes whitespace

* More whitespace fixes

* Reverts apln list to maintain existing behavior
@epau epau force-pushed the 870-event-streaming-impl branch from 2b07799 to 708c1db Compare April 19, 2023 19:58
@epau epau marked this pull request as ready for review April 20, 2023 13:36
@epau epau requested a review from jbelkins April 20, 2023 13:36
@epau epau merged commit dcbeb7d into main Apr 21, 2023
@epau epau deleted the 870-event-streaming-impl branch April 21, 2023 18:00
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.

3 participants