Skip to main content

Module writer

Module writer 

Source
Expand description

QLOG file writer plumbing – compression-aware companion to crate::reader.

This module owns the writer-side surface for emitting JSON-SEQ qlog streams, optionally wrapped in a streaming compressor. It is a deliberate exception to the qlog crate’s otherwise pure-data posture: the writer helpers, the compression enum, and the filename / extension conventions live here so any consumer (tokio-quiche, crate::reader::QlogSeqReader::with_file, external tooling) shares a single canonical writer story.

Compression is opt-in via Cargo features:

  • gzip pulls in flate2.
  • zstd pulls in the [zstd] crate (C dependency via zstd-sys).

The QlogCompression enum’s Gzip and Zstd variants are compile-time gated on their respective features, so a build that disables one of them cannot construct the unsupported variant.

Bytes flow producer -> [compressor] -> W where W is any Write + Send + Sync + 'static. No buffering is added here: both flate2 and zstd emit output in large chunks (DEFLATE blocks / zstd frames), so an extra BufWriter is redundant; callers are free to add one if they need to.

Enums§

QlogCompression
Compression algorithm applied to QLOG output streams.

Functions§

make_qlog_writer
Wrap inner in the streaming encoder selected by compression and return a boxed Write that a qlog producer (e.g. quiche via set_qlog) writes into.
make_qlog_writer_from_path
Convenience function to create a File at path with a writer based on compression.
qlog_file_name
Return the qlog filename (not including the directory) for a stream whose identifier is id, with the suffix matching compression: <id>.sqlog, <id>.sqlog.gz, or <id>.sqlog.zst.

Type Aliases§

QlogFileWriter
Boxed Write returned by make_qlog_writer / make_qlog_writer_from_path.