Skip to main content

Crate celeriant_client_wire

Crate celeriant_client_wire 

Source
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 with decompress.
OutFrame
A serialized, possibly-compressed request frame ready to write. Built synchronously by build_frame so the dict bytes never reach an .await.

Functions§

build_frame
Compress an already-serialized body with the cluster dict when compress is 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 ZstdDict body 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.