Skip to main content

Crate clay_codes

Crate clay_codes 

Source
Expand description

Clay (Coupled-Layer) Erasure Codes

Implementation of Clay codes based on the FAST’18 paper: “Clay Codes: Moulding MDS Codes to Yield an MSR Code”

Clay codes are MSR (Minimum Storage Regenerating) codes that provide optimal repair bandwidth - recovering a lost node using only β sub-chunks from each of d helper nodes, rather than downloading k full chunks.

§Example

use clay_codes::ClayCode;
use std::collections::HashMap;

// Create a (6, 4, 5) Clay code: 4 data + 2 parity, repair with 5 helpers
let clay = ClayCode::new(4, 2, 5).unwrap();

// Encode data
let data = b"Hello, Clay codes!";
let chunks = clay.encode(data);

// Decode with all chunks
let mut available: HashMap<usize, Vec<u8>> = HashMap::new();
for (i, chunk) in chunks.iter().enumerate() {
    available.insert(i, chunk.clone());
}
let decoded = clay.decode(&available, &[]).unwrap();
assert_eq!(&decoded[..data.len()], &data[..]);

§Modules

  • error: Error types for Clay code operations
  • coords: Coordinate system helpers (plane vectors, companion layers)
  • transforms: Pairwise coupling transforms (PRT/PFT)
  • encode: Encoding implementation
  • decode: Decoding and erasure recovery
  • repair: Single-node optimal repair

Re-exports§

pub use error::ClayError;

Modules§

coords
Coordinate system helpers for Clay codes
decode
Decoding and erasure recovery for Clay codes
encode
Encoding logic for Clay codes
error
Error types for Clay code operations
repair
Single-node repair for Clay codes
transforms
Pairwise transforms for Clay codes

Structs§

ClayCode
Clay (Coupled-Layer) erasure code