[−][src]Struct isa_l_erasure_coder::ErasureCoder
Implementations
impl ErasureCoder
[src]
#[must_use]pub const fn k(&self) -> usize
[src]
#[must_use]pub const fn p(&self) -> usize
[src]
#[must_use]pub const fn m(&self) -> usize
[src]
#[must_use]pub fn encode_matrix(&self) -> &[u8]
[src]
#[must_use]pub fn new(k: usize, p: usize) -> Self
[src]
#[must_use]pub fn new_with_encode_matrix(
k: usize,
p: usize,
encode_matrix: Vec<u8>
) -> Self
[src]
k: usize,
p: usize,
encode_matrix: Vec<u8>
) -> Self
pub fn encode<T, M>(&self, data: impl AsRef<[T]>, bufs: impl AsMut<[M]>) where
T: AsRef<[u8]>,
M: AsMut<[u8]>,
[src]
T: AsRef<[u8]>,
M: AsMut<[u8]>,
Calculate the parities over k
data slices of data and place it into p
buffer slices.
The length of all data slices and all buffer slices must be equal.
Panics
Panics if the length of data
is not equal to k
or if the length of bufs
is not equal
to p
.
pub fn decode<T: AsRef<[u8]>, M: AsMut<[u8]>>(
&self,
blocks: &[T],
erased_idxs: &[usize],
bufs: impl AsMut<[M]>
) -> Result<(), ErrorKind>
[src]
&self,
blocks: &[T],
erased_idxs: &[usize],
bufs: impl AsMut<[M]>
) -> Result<(), ErrorKind>
Decode erased blocks given their indexes and the available blocks
Uses gf_gen_decode_matrix_simple
from the isa-l
crate.
Errors
This function will return an error if the number of provided blocks is smaller than k
or
if no decode matrix can be found.
pub fn decode_with_fn<'a, T: AsRef<[u8]>, M: AsMut<[u8]>>(
&'a self,
blocks: &[T],
erased_idxs: &'a [usize],
gen_decode_matrix: fn(_: &'a [u8], _: &'a [usize], _: usize, _: usize) -> Option<Vec<u8>>,
bufs: impl AsMut<[M]>
) -> Result<(), ErrorKind>
[src]
&'a self,
blocks: &[T],
erased_idxs: &'a [usize],
gen_decode_matrix: fn(_: &'a [u8], _: &'a [usize], _: usize, _: usize) -> Option<Vec<u8>>,
bufs: impl AsMut<[M]>
) -> Result<(), ErrorKind>
Decode erased blocks given their indexes and the available blocks
Uses a custom function to generate a decode matrix with the signature:
fn gf_gen_decode_matrix_simple( encode_matrix: &[u8], erased_idxs: &[usize], k: usize, m: usize, ) -> Option<Vec<u8>>;
Errors
This function will return an error if the number of provided blocks is smaller than k
or
if no decode matrix can be found.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ErasureCoder
impl Send for ErasureCoder
impl Sync for ErasureCoder
impl Unpin for ErasureCoder
impl UnwindSafe for ErasureCoder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,