pub struct LrcCodec { /* private fields */ }Expand description
Local Reconstruction Codes codec.
Produces local parity symbols (one per locality group) plus a global parity symbol. Single failures within a group can be repaired locally.
Implementations§
Source§impl LrcCodec
impl LrcCodec
Sourcepub fn encode(&self, source_data: &[u8], symbol_size: usize) -> LrcEncodeResult
pub fn encode(&self, source_data: &[u8], symbol_size: usize) -> LrcEncodeResult
Encode source data into source symbols + local/global parities.
source_data is split into symbol_size-byte symbols.
Each locality group of r symbols gets a local parity (XOR).
A global parity (XOR of all source symbols) is also computed.
Sourcepub fn repair(
&self,
encode_result: &LrcEncodeResult,
available: &HashMap<u32, Vec<u8>>,
missing: &[u32],
) -> Vec<LrcRepairOutcome>
pub fn repair( &self, encode_result: &LrcEncodeResult, available: &HashMap<u32, Vec<u8>>, missing: &[u32], ) -> Vec<LrcRepairOutcome>
Attempt to repair missing symbols using local and global parities.
available maps symbol index -> data for symbols that are present.
missing lists the indices of symbols that need repair.
Returns the repair outcome.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LrcCodec
impl RefUnwindSafe for LrcCodec
impl Send for LrcCodec
impl Sync for LrcCodec
impl Unpin for LrcCodec
impl UnsafeUnpin for LrcCodec
impl UnwindSafe for LrcCodec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).