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

platform: close streams explicitly with data or trailers #798

Merged
merged 1 commit into from Apr 20, 2020

Conversation

rebello95
Copy link
Contributor

@rebello95 rebello95 commented Apr 20, 2020

Replaces the close(trailers: Map<String, List<String>>?) function with two new functions (one for closing with data, and one for closing with trailers).

This removes the ambiguity of how a stream will be closed by making the consumer specify explicitly whether they'd like to close a stream using trailers or data.

The change is being done as a precursor for integrating L7 Swift/Kotlin filters, which will have interfaces in which trailers are not nullable.

Signed-off-by: Michael Rebello me@michaelrebello.com

Replaces the `close(trailers: Map<String, List<String>>?)` function with two new functions (one for closing with data, and one for closing with trailers).

This removes the ambiguity of how a stream will be closed by making the consumer specify it explicitly.

The change is being done as a precursor for integrating L7 Swift/Kotlin filters, which will have interfaces in which trailers are not nullable.

Signed-off-by: Michael Rebello <me@michaelrebello.com>
return
}
stream.sendData(ByteBuffer.allocate(0), true)
override fun close(trailers: Map<String, List<String>>) {

Choose a reason for hiding this comment

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

Not going to keep the comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're specified in the superclass, so I figured it was better to have them in one place rather than copy-pasted to every implementation. WDYT?

Choose a reason for hiding this comment

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

Could we also delete the other comments? If it's a lot to change, we can both do it in another PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do it in a follow up PR yep, waiting on this to merge to avoid conflicts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

stream.sendTrailers(trailers)
}

override fun close(byteBuffer: ByteBuffer) {

Choose a reason for hiding this comment

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

What was the rationale for making this required (instead of having something like fun close(byteBuffer: ByteBuffer = ByteBuffer.allocate(0)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It'd be ambiguous if we did that for trailers as well, right? Consumers calling .close() would no longer be able to differentiate between data and trailers

Choose a reason for hiding this comment

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

Ah so the change here is to introduce the concept of closing with data versus closing with trailers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

Copy link

@buildbreaker buildbreaker left a comment

Choose a reason for hiding this comment

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

Just an optional comment about the API change

Copy link
Member

@junr03 junr03 left a comment

Choose a reason for hiding this comment

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

Related to closing the stream. Right now we don't have a convenience API for a headers only request. For instance a send method that does not return a StreamEmitter because you send with as an only headers request. Thoughts on fixing that here vs in a different PR?

@rebello95
Copy link
Contributor Author

Related to closing the stream. Right now we don't have a convenience API for a headers only request. For instance a send method that does not return a StreamEmitter because you send with as an only headers request. Thoughts on fixing that here vs in a different PR?

Yep I'll go ahead and update some of that in a follow up PR

@rebello95 rebello95 merged commit b3b27c5 into master Apr 20, 2020
@rebello95 rebello95 deleted the close-data branch April 20, 2020 22:44
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

3 participants