Create high-level AWS event streams #322
Merged
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.
This updates the high-level event stream interfaces and creates AWS implementations of them.
The
EventStream
protocol was split into three protocols:DuplexEventStream
,InputEventStream
, andOutputEventStream
. These three classes encompass the three different configurations that clients can expect, and each are typed with their particular use-case in mind. This lets the type declarations be more concise and accurate. Before, it could be extremely ambiguous from a typing perspective what you were getting.The old
InputEventStream
andOutputEventStream
classes were renamed toAsyncEventPublisher
andAsyncEventReceiver
, respectively. This is a more accurate description of what they do, particularly as they can be used for a service implementation as well.In the AWS implementation, some changes needed to be made. Notably the
Event
class had to get adecode_async
method to be able to read from an async stream. Then the calling of that method had to be pulled out of the deserializer so that both sync and async clients can use it. Test cases were updated to also test the async method.Tests for the event stream classes will come in the form of protocol tests later on.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.