#[non_exhaustive]pub struct ProducerConfig {
pub op_ratio: u32,
pub compression: bool,
pub checkpoint_records: Option<usize>,
}Expand description
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.op_ratio: u32How much the ops in a group may cost before a fresh group is emitted.
A new group opens once the pushes and pops already written exceed op_ratio times the
size of the group’s header frame. The pending op is excluded from that check, so the one that
tips the group over budget still lands: a group overshoots by at most one op before rolling.
0 disables ops entirely, so every edit is its own single-frame group.
This is the window’s counterpart to
snapshot::Config::delta_ratio, and
the same trade: a bigger ratio spends less on headers and makes a late joiner read more ops.
Defaults to 8.
compression: boolCompress each group as one sync-flushed DEFLATE stream, so every op reuses the header and the ops before it as context.
false (the default) emits plaintext JSON frames. A Decoder reading them
must set ConsumerConfig::compression to match.
checkpoint_records: Option<usize>Maximum records retained and repeated in a group checkpoint.
None (the default) repeats the complete window. A bound keeps checkpoints finite for an
unbounded window: readers following every group retain earlier records, while one joining a
later group receives Event::Skip for the omitted prefix.
Implementations§
Source§impl ProducerConfig
impl ProducerConfig
Sourcepub fn with_op_ratio(self, op_ratio: u32) -> Self
pub fn with_op_ratio(self, op_ratio: u32) -> Self
Set op_ratio (a builder, since the struct is #[non_exhaustive]).
Sourcepub fn with_compression(self, compression: bool) -> Self
pub fn with_compression(self, compression: bool) -> Self
Set compression (a builder, since the struct is #[non_exhaustive]).
Sourcepub fn with_checkpoint_records(self, checkpoint_records: usize) -> Self
pub fn with_checkpoint_records(self, checkpoint_records: usize) -> Self
Set checkpoint_records. Must be at least one.