RsSimd (rs_simd v0.1.0)

Reed-Solomon erasure coding with SIMD acceleration

Summary

Functions

Decodes and repairs the original message, returning all shards

Decodes missing original shards from available shards.

Encodes data into recovery shards.

Functions

correct(original_shards, recovery_shards, provided_original, provided_recovery)

Decodes and repairs the original message, returning all shards

Parameters

  • original_shards: Original number of data shards
  • recovery_shards: Number of recovery shards that were generated
  • provided_original: List of {index, shard} tuples for available original shards
  • provided_recovery: List of {index, shard} tuples for available recovery shards

Returns

{:ok, %{index => restored_shard}} or {:error, reason}

decode(original_shards, recovery_shards, provided_original, provided_recovery)

Decodes missing original shards from available shards.

Parameters

  • original_shards: Original number of data shards
  • recovery_shards: Number of recovery shards that were generated
  • provided_original: List of {index, shard} tuples for available original shards
  • provided_recovery: List of {index, shard} tuples for available recovery shards

Returns

{:ok, %{index => restored_shard}} or {:error, reason}

encode(original_shards, recovery_shards, data)

Encodes data into recovery shards.

Parameters

  • original_shards: Number of original data shards
  • recovery_shards: Number of recovery shards to generate
  • data: List of binaries representing original shards

Returns

{:ok, [recovery_shard1, ...]} or {:error, reason}