Skip to main content

Module MessageCompressor

Module MessageCompressor 

Source
Expand description

§Message Compressor and Batching

Buffers IPC messages into batches, then compresses on flush using Brotli / Gzip / Zlib at the configured level. Compressor::Struct is the engine; the DTOs are split into their own siblings.

Modules§

BatchConfig
Compressor / batcher tunables - max batch size, max delay before flushing, the size threshold below which messages pass through uncompressed, and the algorithm + level pair.
BatchStats
Lightweight in-flight batch counters - message count, current byte total, and elapsed time since the first message landed.
CompressedBatch
Result envelope returned by Compressor::Struct::flush_batch. Carries the message count, original / compressed byte totals, the compressed bytes (None when below threshold), the CompressionInfo::Struct, and the flush timestamp.
CompressionAlgorithm
Wire-format selector for the compressor - Brotli, Gzip, or Zlib. The compressor delegates to the matching encoder / decoder pair.
CompressionInfo
Per-batch compression metadata - algorithm name, level, and the achieved ratio. none() produces the uncompressed sentinel (algorithm:"none", ratio:1.0).
CompressionLevel
Compression strength dial - Fast (1), Balanced (6), High (11). Maps directly to Brotli quality / flate2 compression level.
Compressor
Compressor::Struct - message batching + compression engine. Buffers messages until size or time triggers a flush, then emits a CompressedBatch::Struct using the configured algorithm. Struct + 14-method impl + utility functions stay in one file - tightly coupled cluster.