Skip to content
LimniFS

16. Erasure coding

This section is normative for wire-format-relevant invariants. Full algorithm specs live in component 07-erasure-coding.

16.1 Reed-Solomon layout

Per 02-algorithms.md §7:

per slab S:
  data shards    = k  shards of size ceil(|S| / k), zero-padded tail
  parity shards  = m  shards via RS(k+m) over GF(2^8)
  polynomial     = 0x011D (default; per-image override possible)
  shard_record   = (slab_id, shard_index in [0, k+m), BLAKE3(shard),
                   locator_entry)
  reconstruct(any k of k+m) = Berlekamp-Welch / Cauchy-matrix inversion
                              verify BLAKE3(join(data_shards)) == slab_hash
                              before yielding

16.2 Reconstruction trigger

When fewer than k data shards are available, the locator layer returns the available data shards plus the needed parity shards. The reader reconstructs the missing data and verifies against the slab hash before yielding the slab bytes.

Reconstruction cost: O(k²) matrix inversion once + O(n·k) apply. This is bounded by the slab size, not the image size.

When k data shards ARE available, parity shards are NOT fetched — data is read directly. The parity is purely availability insurance.

16.3 Image-level vs slab-level EC

The manifest’s EC params section (§5.6) sets image-level defaults (k, m, polynomial). Per-slab overrides are allowed in the slab index (§5.4) for slabs with different reliability requirements.

Default values are NOT specified by the spec — they are reader/writer policy choices recorded in the manifest. A typical default is k=4, m=2 (per the architecture overview).