Interface ChunkedRestResponseBodyPart

All Known Implementing Classes:
LoggingChunkedRestResponseBodyPart

public interface ChunkedRestResponseBodyPart

A body (or a part thereof) of an HTTP response that uses the chunked transfer-encoding. This allows Elasticsearch to avoid materializing the full response into on-heap buffers up front, instead serializing only as much of the response as can be flushed to the network right away.

Each ChunkedRestResponseBodyPart represents a sequence of chunks that are ready for immediate transmission: if isPartComplete() returns false then encodeChunk(int, org.elasticsearch.common.recycler.Recycler<org.apache.lucene.util.BytesRef>) can be called at any time and must synchronously return the next chunk to be sent. Many HTTP responses will be a single part, but if an implementation's isLastPart() returns false at the end of the part then the transmission is paused and getNextPart(org.elasticsearch.action.ActionListener<org.elasticsearch.rest.ChunkedRestResponseBodyPart>) is called to compute the next sequence of chunks asynchronously.