Skip to main content

Module frame

Module frame 

Source
Expand description

Wire frame codec. Mirrors the Go reference in go/frame/frame.go.

Layout: 24-byte big-endian header (magic, version, flags, method, request id, meta length, payload length), then Protobuf meta, then raw payload bytes.

Structs§

Frame
One decoded message. Build it with Frame::new. New fields can be added in a minor version.

Constants§

FLAG_ERROR
FLAG_NOTIFY
Server-initiated frame (a notice). The request id is the id of the call it answers.
FLAG_RESPONSE
FLAG_STREAM_END
HEADER_SIZE
MAGIC
MAX_META_BYTES
MAX_PAYLOAD_BYTES
VERSION

Functions§

check_limits
Rejects sections over the limits. Callers run this before they send a byte, so an oversize request fails alone and leaves the connection usable.
read
Reads one frame. Returns Ok(None) only when the stream ends cleanly at a frame boundary. A mid-frame end is an UnexpectedEof I/O error.
write
Writes one frame. Rejects sections over the limits before sending anything.
write_parts
Writes one frame from borrowed sections with a single vectored write, so the payload is not copied and the header, meta and payload leave in one call.