You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New opt-in serde feature (implies framed): framing::serde stores serde values and row streams in framed containers, column by column.
Importing the sealed SerdeCompress and SerdeDecompress traits adds compress_value, compress_rows and rows_writer to FramedCompressor
and decompress_value, decompress_rows and rows_reader to FramedDecompressor. Every site of a value (a struct field, a sequence's
elements, an enum's variant index, an Option's flag) becomes one typed
input: numbers numeric, strings and bytes string, u128/i128 16-byte
struct; lengths and variant indices are narrowed per block. Rows are cut
into blocks of about BlockSize raw bytes (1 MiB by default), one
self-contained resource each, with a layout descriptor in metadata SD.
Each resource's frame equals the reference's compress_generic frame of
the same columns. The descriptor stores the block's schema (field and
variant names, the kind of every column), so the format describes itself:
fields are matched by name, a place may change shape between visits (a
one-byte state column records which shape, or that a field was skipped),
and deserialize_any reports the stored value. skip_serializing_if, #[serde(skip)], added and removed fields, untagged, internally and
adjacently tagged enums, flatten and serde_json::Value round-trip, and
numbers convert as serde's visitors allow (widening yes, lossy or
float/integer reinterpretation no). Maps whose keys are names (strings,
unit variants, newtypes of them) are stored as records: each distinct key
gets its own columns, and a key column keeps entry order and repeats; a
map names at most 256 keys per block and stores the rest as values. On
100k JSON log lines as serde_json::Value the container is 15.12x smaller
than the JSON text (8.76x for the text through serial OpenZL; 9.92x with
keys stored as values). On benches/framed_serde.rs the
container is 9.51x smaller than 100k structured log rows in a row-major
layout (5.69x for that layout through serial OpenZL) and 11.50x for 200k
numeric samples (3.96x). Rows decode at 350-650 MiB/s of row-major size;
the columns themselves decode at C speed and rebuilding rows dominates.
framing::serde::columns, an attribute macro from the new mopenzl-macros crate (pulled in by serde), placed above the serde
derives. #[column(id = N)] stores a named field by number instead of by
name, like protobuf: the block schema drops the name, a renamed field keeps
reading earlier rows, and the field also accepts the key "#N", so
numbered structs read through untagged and internally tagged enums, flatten and serde_json::Value. #[column(codec = "graph")] compresses
the columns of the field's values with the compressor's graph of that name
(a standard graph, or one registered with GraphParams::with_name); a
block with such columns is compressed with a router graph that sends each
marked column to its graph, converting it to serial bytes for serial-only
graphs, and the other columns together to the compressor's start graph.
Blocks without codecs are unchanged, the decoder needs no configuration,
and the C library decodes the routed frames. Other formats see marked
types unchanged. A codec that cannot be used is the new SerdeError::Codec. Field names are now limited to 65534 bytes.
#[column] keeps a field's own with or serialize_with in generic types:
the expansion declares a wrapper next to the item over the parameters the
field's type mentions and the bounds on them.
The workspace shares one version: [workspace.package] holds the version,
edition, minimum Rust, license and links that mopenzl, mopenzl-macros
and openzl-ffi inherit (openzl-ffi moves from 0.1.0 to the crate
version), and [workspace.dependencies] pins mopenzl-macros to the same
exact version. The release workflow publishes both crates with cargo publish --workspace.
README, crate documentation and the book introduce the serde feature as a
compressed serialization format for any Rust type, with examples and the
measured ratios; serde is a crate keyword.