Expand description
Send-safe client frame I/O over celeriant_wire.
A tokio client connection compresses request bodies with the cluster’s zstd dictionary. The
compression dictionary is held as raw bytes (&[u8], which is Send + Sync) and digested per
call via the stateless compress_with_dict/decompress_with_dict helpers — NOT as a
precompiled DictCodec, which is RefCell-backed (!Sync) and would make a request future
!Send if held across an .await, and which (measured) does not improve end-to-end throughput
on a server-bound write path while costing one resident codec per connection.
The codec is only touched in the synchronous build_frame/decompress calls; the
async write_frame/read_frame move only bytes across .await. Both the storage and
queue tokio clients drive the same four functions.
Structs§
- InFrame
- A frame read off the wire: its message type plus the raw (still-compressed) body. Produced by
read_frame; decompress withdecompress. - OutFrame
- A serialized, possibly-compressed request frame ready to write. Built synchronously by
build_frameso the dict bytes never reach an.await.
Functions§
- build_
frame - Compress an already-serialized body with the cluster
dictwhencompressis set and a dict is present, else pass it through uncompressed (e.g. a client that has not yet negotiated a dict). - decompress
- Decompress a frame’s body with the cluster
dict. Synchronous, and zero-copy when the frame is uncompressed (borrows the body in place). - decompress_
body - Decompress a body from its header parts — for callers (e.g. the storage client) that read the
header separately to dispatch fixed- vs variable-size frames before reading the body. Synchronous,
zero-copy when uncompressed. A
ZstdDictbody with no dict is a malformed frame. - read_
frame - Read one frame’s header and raw body. Dict-free, so the returned future is
Send. - write_
frame - Write a prepared frame. Dict-free, so the returned future is
Send.