#erasure-coding #error #api-bindings #build #require #openstack-liberasurecode #erasure-coder

sys liberasurecode

A Rust wrapper for openstack/liberasurecode

4 stable releases

Uses old Rust 2015

1.0.3 Aug 21, 2019
1.0.2 Oct 12, 2018
1.0.1 Oct 2, 2018
1.0.0 Sep 27, 2018

#5 in #erasure-coding

Download history 4/week @ 2023-11-16 3/week @ 2023-11-23 2/week @ 2023-11-30 2/week @ 2024-02-08 20/week @ 2024-02-15 28/week @ 2024-02-22 17/week @ 2024-02-29

67 downloads per month
Used in 3 crates (via ecpool)

MIT license

35KB
632 lines

liberasurecode

Crates.io: liberasurecode Documentation Build Status License: MIT

A Rust wrapper for openstack/liberasurecode.

Documentation

Prerequisites to Build

This crate requires the following packages for building openstack/liberasurecode in the build script:

  • C compiler (e.g., gcc)
  • git
  • make
  • automake
  • autoconf
  • libtool

For example, on Ubuntu, you can install those by executing the following command:

$ sudo apt install gcc git make automake autoconf libtool

Examples

Basic usage:

use liberasurecode::{ErasureCoder, Error};

let mut coder = ErasureCoder::new(4, 2)?;
let input = vec![0, 1, 2, 3];

// Encodes `input` to data and parity fragments
let fragments = coder.encode(&input)?;

// Decodes the original data from the fragments (or a part of those)
assert_eq!(Ok(&input), coder.decode(&fragments[0..]).as_ref());
assert_eq!(Ok(&input), coder.decode(&fragments[1..]).as_ref());
assert_eq!(Ok(&input), coder.decode(&fragments[2..]).as_ref());
assert_eq!(Err(Error::InsufficientFragments), coder.decode(&fragments[3..]));

Dependencies

~42KB