ecpool
This crate provides thread pool (ErasureCoderPool
) for managing executions of erasure coding.
ecpool
also provides ErasureCode
trait defines erasure coding interface
and of which implemtations can be executed via ErasureCoderPool
.
There are some built-in implementations of the trait:
LibErasureCoder
:- This implementation uses
liberasurecode
crate that is a wrapper for openstack/liberasurecode library. - It is highly optimized and stable but only available in Unix environments.
- This implementation uses
ReplicaCoder
:- This implementation simply replicates the input data.
- It is provided for example and testing purposes only and not intended to use in production.
Build Prerequisites
It is required to install openstack/liberasurecode and its dependencies by executing the following commands before building this crate:
$ git clone https://github.com/frugalos/liberasurecode
$ cd liberasurecode && sudo ./install_deps.sh
Examples
Basic usage:
use ReplicaCoder;
use ;
use NonZeroUsize;
use Result;
use ;
// Creates a pool
let data_fragments = new.ok_or_else?;
let parity_fragments = new.ok_or_else?;
let coder = new;
// Encodes
let data = vec!;
let encoded = execute?;
// Decodes
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;