Skip to content

How to use Body::wrap_stream? #1027

Answered by tzcnt
tzcnt asked this question in Q&A
Jun 28, 2022 · 4 comments · 2 replies
Discussion options

You must be logged in to vote

Due to the fact that the encoding of a repeated field requires the length value at the beginning, for the use case where I am receiving an unknown number of entries from the database (and each individual entry may be of a variable size due to varint encoding), they cannot be serialized and transmitted "on-demand" within the context of a single message. I would need to receive all of the entries first, calculate the length properly, and then serialize them. This seems to be a restriction of the Protobuf format itself, not of Tonic.

Thus I will need to use a gRPC server-side streaming RPC.

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@davidpdrsn
Comment options

Comment options

You must be logged in to vote
1 reply
@davidpdrsn
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by tzcnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants