Skip to main content

Crate rusty_erasure

Crate rusty_erasure 

Source
Expand description

rusty_erasure — Intel ISA-L’s erasure coding, remade with Rust.

The facade crate: the typed public API (Matrix, Coder), parameter validation, the ISA-L-named compat layer (isal), and kernel dispatch — resolved ONCE at coder/best_kernels, never inside a loop. The always-on reach census reports which kernel set production bytes actually flow through.

Conformance is byte identity with ISA-L’s erasure_code module across the full config matrix — exact GF(2^8) integer math, no tolerance anywhere. Mission plan: docs/plans/erasure_mission.md.

Modules§

census
The always-on kernel-reach census (mission plan §7.1).
compat
Compatibility constructions for migrating from other erasure engines — the payoff of a matrix-flexible API: adopt the incumbent’s exact matrix and its shards stay valid in both directions, no format break.
gf
GF(2^8) arithmetic over the field ISA-L uses: the polynomial x^8 + x^4 + x^3 + x^2 + 1 (0x11d), generator 2.
isal
The ISA-L compat layer: functions named and shaped like Intel ISA-L’s erasure-code API, so C callers and ISA-L’s own tests port line-for-line.
kernel
Scalar erasure-coding kernels — the permanent oracles every SIMD twin (M4) is gated against, and the fallback on every CPU.
matrix
Coding matrices: generation (Vandermonde / Cauchy), inversion, and row selection for recovery.
raid
RAID parity ops, dispatched: AVX2 kernels when the CPU has them (byte- identical to the scalar core, oracle-tested), the core implementation otherwise. Checks always run the core code (they are already word-wide).
tables
Expanded multiplication tables — ISA-L’s ec_init_tables layout, bit-identical: 32 bytes per coefficient c, being the two PSHUFB nibble tables {c*0, c*1, ..., c*15} then {c*0x00, c*0x10, ..., c*0xf0}.

Structs§

Coder
An erasure coder for one (matrix) configuration: k source shards in, p parity shards out, recovery from any k survivors.
DecodePlan
A prepared decode: the survivor selection, inverted submatrix (composed into per-target coefficient rows), and expanded tables for ONE loss pattern — reusable across every stripe sharing that pattern. Built by Coder::decode_plan, consumed by Coder::recover_with.
Matrix
A row-major rows x cols matrix over GF(2^8).

Enums§

CodeError
Errors from encode and update operations.
MatrixError
Errors from coding-matrix construction and inversion.
RecoverError
Errors from the recovery path.

Functions§

best_kernels
The best kernel set for the running CPU: the accel SIMD sets when the accel feature is on and the CPU supports them (detection cached), the scalar oracle otherwise. Resolved once per call site — hold the result or build a Coder with coder rather than re-asking in a loop.
coder
Build a Coder driving the best kernel set for this CPU. This is the constructor applications want; Coder::new in core is the always-scalar variant.
kernels_named
Look up a kernel set by name — the bench/census arms: "auto", "scalar", "ssse3", "avx2", "gfni". None when the name is unknown or the CPU lacks the feature.