pub struct ErasureCoding;Expand description
Erasure coding abstraction.
Supports creation of parity shards and recovery of missing data.
Implementations§
Source§impl ErasureCoding
impl ErasureCoding
Sourcepub fn extend<const NUM_SHARDS: usize, const SHARD_BYTES: usize>(
&self,
source: &[[u8; SHARD_BYTES]; NUM_SHARDS],
parity: &mut [[u8; SHARD_BYTES]; NUM_SHARDS],
) -> Result<(), ErasureCodingError>
pub fn extend<const NUM_SHARDS: usize, const SHARD_BYTES: usize>( &self, source: &[[u8; SHARD_BYTES]; NUM_SHARDS], parity: &mut [[u8; SHARD_BYTES]; NUM_SHARDS], ) -> Result<(), ErasureCodingError>
Extend contiguously stored source shards with parity shards
Sourcepub fn extend_scattered<const NUM_SHARDS: usize, const SHARD_BYTES: usize, SourceShard, ParityShard>(
&self,
source: [SourceShard; NUM_SHARDS],
parity: [ParityShard; NUM_SHARDS],
) -> Result<(), ErasureCodingError>
pub fn extend_scattered<const NUM_SHARDS: usize, const SHARD_BYTES: usize, SourceShard, ParityShard>( &self, source: [SourceShard; NUM_SHARDS], parity: [ParityShard; NUM_SHARDS], ) -> Result<(), ErasureCodingError>
Extend source shards with parity shards, where shards are not stored contiguously
Sourcepub fn recover_source<const NUM_SHARDS: usize, const SHARD_BYTES: usize>(
&self,
source: &mut [[u8; SHARD_BYTES]; NUM_SHARDS],
parity: &[[u8; SHARD_BYTES]; NUM_SHARDS],
present: &ShardsPresent<NUM_SHARDS>,
) -> Result<(), ErasureCodingError>
pub fn recover_source<const NUM_SHARDS: usize, const SHARD_BYTES: usize>( &self, source: &mut [[u8; SHARD_BYTES]; NUM_SHARDS], parity: &[[u8; SHARD_BYTES]; NUM_SHARDS], present: &ShardsPresent<NUM_SHARDS>, ) -> Result<(), ErasureCodingError>
Recover missing source shards in place, with everything stored contiguously.
Parity shards are inputs only, missing ones are simply not used. Prefer this over
Self::recover_all() when parity shards are not needed.
Sourcepub fn recover_source_scattered<const NUM_SHARDS: usize, const SHARD_BYTES: usize, SourceShard, ParityShard>(
&self,
source: [SourceShard; NUM_SHARDS],
source_present: &ShardsBitmap<NUM_SHARDS>,
parity: [Option<ParityShard>; NUM_SHARDS],
) -> Result<(), ErasureCodingError>
pub fn recover_source_scattered<const NUM_SHARDS: usize, const SHARD_BYTES: usize, SourceShard, ParityShard>( &self, source: [SourceShard; NUM_SHARDS], source_present: &ShardsBitmap<NUM_SHARDS>, parity: [Option<ParityShard>; NUM_SHARDS], ) -> Result<(), ErasureCodingError>
Recover missing source shards in place, where shards are not stored contiguously.
Parity shards are inputs only, so missing ones simply have no memory.
Sourcepub fn recover_all<const NUM_SHARDS: usize, const SHARD_BYTES: usize>(
&self,
source: &mut [[u8; SHARD_BYTES]; NUM_SHARDS],
parity: &mut [[u8; SHARD_BYTES]; NUM_SHARDS],
present: &ShardsPresent<NUM_SHARDS>,
) -> Result<(), ErasureCodingError>
pub fn recover_all<const NUM_SHARDS: usize, const SHARD_BYTES: usize>( &self, source: &mut [[u8; SHARD_BYTES]; NUM_SHARDS], parity: &mut [[u8; SHARD_BYTES]; NUM_SHARDS], present: &ShardsPresent<NUM_SHARDS>, ) -> Result<(), ErasureCodingError>
Recover missing source and parity shards in place, with everything stored contiguously.
Use Self::recover_source() instead if parity shards are not needed.
Sourcepub fn recover_all_scattered<const NUM_SHARDS: usize, const SHARD_BYTES: usize, SourceShard, ParityShard>(
&self,
source: [SourceShard; NUM_SHARDS],
parity: [ParityShard; NUM_SHARDS],
present: &ShardsPresent<NUM_SHARDS>,
) -> Result<(), ErasureCodingError>
pub fn recover_all_scattered<const NUM_SHARDS: usize, const SHARD_BYTES: usize, SourceShard, ParityShard>( &self, source: [SourceShard; NUM_SHARDS], parity: [ParityShard; NUM_SHARDS], present: &ShardsPresent<NUM_SHARDS>, ) -> Result<(), ErasureCodingError>
Recover missing source and parity shards in place, where shards are not stored contiguously
Trait Implementations§
Source§impl Clone for ErasureCoding
impl Clone for ErasureCoding
Source§fn clone(&self) -> ErasureCoding
fn clone(&self) -> ErasureCoding
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more