Skip to main content

Module codec

Module codec 

Source
Expand description

Codec layer: OpenZL compression/decompression. OpenZL is znippy’s codec — it wraps zstd+lz4 with improved framing.

§The openzl feature — this file is the ONE gate

openzl-sys-rs 0.3.0 vendors the OpenZL, zstd and lz4 C sources and compiles them with cc — no network, no shell, no curl/tar/cmake, no stdc++. What it still requires is a build script and a C compiler, which a consumer targeting pure Rust, or building with no C toolchain present, does not have.

Rather than #[cfg] the six call sites that touch the codec — archive.rs, views.rs, decompress.rs (×2), meta_sink_append.rs, plugins/wasm_loader.rs — and fracture the public API into two shapes, the gate lives here alone (LAW 5: one writer both paths route through). Every item below keeps its exact signature with the feature off; the bodies return [NO_CODEC] instead. So:

  • the default build is byte-identical to before — same code, same behaviour;
  • default-features = false drops openzl-sys-rs from the graph outright, leaving the archive format, the Arrow index, the searchable metadata sub-index and the plugin trait fully usable with no build script at all;
  • a caller that does reach a compressed blob in such a build gets a named error, never a wrong answer or a silent empty result.

Reading stored (uncompressed) entries needs no codec and keeps working either way — that path never enters this module.

Structs§

CompressCtx

Functions§

decompress_frame
decompress_into
Decompress into a reusable buffer; returns bytes written (out is truncated to that). Reuse the same out across chunks to keep the decompress path allocation-free (the no-hot-path-alloc rule).