Expand description
Server-side frame construction discipline.
Every server-emitted frame today is built by stitching together
Frame::new + Frame::with_stream + Frame::with_flags at
the call site. That spreads four invariants across every dispatch
path:
- Correlation-id propagation — each response must echo the
request frame’s id (or
0for unsolicited frames). MORE_FRAMESsequencing — only the last frame of a multi- frame reply may clear the flag.MAX_FRAME_SIZEenforcement — the codec checks on decode but a producer happily encodes oversized frames the peer will reject anyway.- Compression policy — callers either opt in by setting
Flags::COMPRESSEDor do not, and the codec silently falls back to plaintext on incompressible input.
FrameBuilder owns those invariants. The acceptance test for
this module is the deletion test: deleting builder.rs forces
frame-construction discipline back to inline Frame::new calls
at every dispatch site.
ⓘ
use reddb_wire::redwire::{FrameBuilder, MessageKind};
let frame = FrameBuilder::reply_to(request.correlation_id)
.kind(MessageKind::Result)
.payload(body)
.stream_id(42)
.more_frames(false)
.build()?;The builder is engine-free — it only depends on Frame,
MessageKind, Flags, and the size constants from this
crate. Server dispatch (auth, session, listener) constructs
frames through the builder; the codec stays focused on bytes.
Structs§
- Frame
Builder - Builder for server-emitted
Frames.
Enums§
- Build
Error - Errors surfaced at
build()time so they fail at construction rather than at encode time, where the call site has already lost the context to recover.