Skip to content
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

Add requirement that channel is accessible in ServerChildChannel.Value #450

Merged
merged 4 commits into from
May 15, 2024

Conversation

adam-fowler
Copy link
Member

This adds an additional requirement on the Value passed around by a ServerChildChannel that the Channel that spawned the child channel is accessible from the Value.

This PR doesn't add any additional functionality. It is here to prepare for the situation where we need the EventLoop for the Task executor.

@adam-fowler adam-fowler requested a review from Joannis May 14, 2024 09:46
/// Protocol for typed server child channel
public protocol ServerChildChannelValue: Sendable {
/// Child channel that spawned child channel
var channel: Channel { get }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better if we add var eventLoop: EventLoop here? This assumes we're using a NIO.Channel, whereas we could have other implementations such as Lambda that aren't connected to a socket at all.

I would even consider removing this requirement entirely, and replacing it with something like this:

func addTask<Failure: Error>(
  _ operation: @escaping () async throws -> Void,
  to taskGroup: inout ThrowingDiscardingTaskGroup<Failure>
)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ServerChildChannel assumes we are using a NIO.Channel anyway. It is there to setup a NIO child channel. This code is never run on lambda.

I'm not exactly sure how you would use the addTask function

Sources/HummingbirdHTTP2/HTTP2Channel.swift Outdated Show resolved Hide resolved
Sources/HummingbirdHTTP2/HTTP2Channel.swift Outdated Show resolved Hide resolved
Sources/HummingbirdHTTP2/HTTP2Channel.swift Outdated Show resolved Hide resolved
adam-fowler and others added 3 commits May 14, 2024 16:49
Co-authored-by: Joannis Orlandos <joannis@orlandos.nl>
Co-authored-by: Joannis Orlandos <joannis@orlandos.nl>
Co-authored-by: Joannis Orlandos <joannis@orlandos.nl>
@adam-fowler adam-fowler merged commit 3f9d6b3 into main May 15, 2024
4 of 5 checks passed
@adam-fowler adam-fowler deleted the child-channel-value branch May 15, 2024 17:10
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.

None yet

2 participants