Skip to main content

Module bytes_gatherer

Module bytes_gatherer 

Source
Expand description

§Scatter-gather buffer for zero-copy response assembly

The single export from this module — BytesGatherer — is how large payloads (post bundles, feedback bundles) are threaded from storage, through the protocol layer, through compression, and on to the transport, without ever being memcpy’d by the application.

Small POD fields (RPC headers, counters, signatures) accumulate into an internal BytesMut scratchpad; large already-refcounted Bytes blobs attach by reference with BytesGatherer::put_bytes. At the transport boundary BytesGatherer::compact merges adjacent small segments into one and BytesGatherer::finish yields a Vec<Bytes> suitable for vectored I/O or HTTP/2 DATA frames.

See the doc comment on BytesGatherer for the motivating GetPostBundle example and the on-the-wire segment layout.

Structs§

BytesGatherer
A scatter-gather buffer that threads large blobs through the response pipeline by reference, eliminating application-layer copies for bulk data such as post bundles.