Skip to content

getRequestBodyChunk should indicate if a chunk is the last one #109

@edsko

Description

@edsko

For streaming calls, clients have two ways of indicating end-of-input to the sever:

NON-EMPTY DATA FRAME 1  <not marked as end-of-stream>
NON-EMPTY DATA FRAME 2  <not marked as end-of-stream>
NON-EMPTY DATA FRAME 3  <marked as end-of-stream>

and

NON-EMPTY DATA FRAME 1  <not marked as end-of-stream>
NON-EMPTY DATA FRAME 2  <not marked as end-of-stream>
NON-EMPTY DATA FRAME 3  <not marked as end-of-stream>
EMPTY DATA FRAME 4 <marked as end-of-stream>

getRequestBodyChunk does not allow servers to differentiate between these two cases; in both cases, we will first get a non-empty bytestring indicating the last piece of data, and then the next call to getRequestBodyChunk will return an empty bytestring. Calling getRequestBodyChunk again to figure out after-the-fact if the previously received bytestring was the final one is not an option, because that call may block. We therefore need a generalization that doesn't just give us a bytestring, but also tells us if that bytestring was marked being the last one.

For an example of where this matters, see well-typed/grapesy#114 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions