Skip to content

feat(grpc): Remove trailers from SendStream and make Handle return …#2601

Open
sauravzg wants to merge 1 commit intomasterfrom
sauravz/handle-trailers
Open

feat(grpc): Remove trailers from SendStream and make Handle return …#2601
sauravzg wants to merge 1 commit intomasterfrom
sauravz/handle-trailers

Conversation

@sauravzg
Copy link
Copy Markdown
Collaborator

  • Server sendstream doesn't write trailers anymore
  • Handle returns Trailer
  • Compatibility
    • current server's Call had to be updated to provide a method to write trailers
    • in memory transport had to get a few major changes including how client receives the data, requiring oneshots to handle receiving trailer from in memory server.

@sauravzg sauravzg force-pushed the sauravz/handle-trailers branch from 507787e to e2f4bd0 Compare April 23, 2026 18:29
Comment thread grpc/src/server/mod.rs
Comment on lines +155 to +156
/// Sending is considered complete when the `handle` method returns
/// `Trailers`.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I wouldn't mention stuff about handle in here. The SendStream works until it's dropped, really.

One thing we should probably mention instead is that if SendOptions.final_msg is set, then no subsequent calls should be made.

Comment thread grpc/src/server/mod.rs
pub headers: RequestHeaders,
pub send: SS,
pub recv: RS,
pub trailers_tx: oneshot::Sender<Trailers>,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not really sure how I feel about this Listener API now, because of this. I wonder if there's a nicer design here. But, we can debate about it later.

Comment thread grpc/src/inmemory/mod.rs
Comment on lines +320 to +322
if let Ok(trailers) = trailer_rx.await {
return ClientResponseStreamItem::Trailers(trailers);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this just .expect instead or something? It's a bug if no trailers were sent on the channel and the stream is done, isn't it?

Comment thread grpc/src/inmemory/mod.rs
Headers(ResponseHeaders),
Message(Box<dyn Buf + Send + Sync>),
Trailers(Trailers),
StreamClosed,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does this one not also go away?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants