2014-11-29 16:18:52 -05:00
|
|
|
// Package erasure is a Go wrapper for the Intel Intelligent Storage
|
|
|
|
// Acceleration Library (Intel ISA-L). Intel ISA-L is a CPU optimized
|
|
|
|
// implementation of erasure code.
|
|
|
|
//
|
|
|
|
// For more information on Intel ISA-L, please visit:
|
|
|
|
// https://01.org/intel%C2%AE-storage-acceleration-library-open-source-version
|
|
|
|
//
|
|
|
|
// Usage
|
|
|
|
//
|
|
|
|
// TODO: Explain Encode and Decode inputs and outputs
|
|
|
|
//
|
|
|
|
// TODO: Explain matrix size and how it corresponds to protection level
|
|
|
|
//
|
|
|
|
// Encoding data may be performed in 3 steps.
|
|
|
|
//
|
2014-11-29 17:58:40 -05:00
|
|
|
// 1. Create a parse set of encoder parameters
|
2014-11-29 16:18:52 -05:00
|
|
|
// 2. Create a new encoder
|
|
|
|
// 3. Encode data
|
|
|
|
//
|
|
|
|
// Decoding data is also performed in 3 steps.
|
|
|
|
//
|
2014-11-29 17:58:40 -05:00
|
|
|
// 1. Create a parse set of encoder parameters for validation
|
2014-11-29 16:18:52 -05:00
|
|
|
// 2. Create a new encoder
|
|
|
|
// 3. Decode data
|
|
|
|
//
|
|
|
|
// Encoder parameters contain four configurable elements:
|
2014-11-29 17:58:40 -05:00
|
|
|
// ParseEncoderParams(k, m, technique int) (EncoderParams, error)
|
2014-11-29 16:18:52 -05:00
|
|
|
// k - Number of rows in matrix
|
|
|
|
// m - Number of colums in matrix
|
|
|
|
// technique - Matrix type, can be either CAUCHY (recommended) or VANDERMONDE
|
2014-11-29 17:58:40 -05:00
|
|
|
// constraints: k + m < Galois Field (2^8)
|
2014-11-29 16:18:52 -05:00
|
|
|
//
|
|
|
|
// Example
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Creating and using an encoder
|
|
|
|
// var bytes []byte
|
2014-11-29 17:58:40 -05:00
|
|
|
// params := erasure.ParseEncoderParams(10, 5, erasure.CAUCHY)
|
2014-11-29 16:18:52 -05:00
|
|
|
// encoder := erasure.NewEncoder(params)
|
|
|
|
// encodedData, length := encoder.Encode(bytes)
|
|
|
|
//
|
|
|
|
// Creating and using a decoder
|
|
|
|
// var encodedData [][]byte
|
|
|
|
// var length int
|
2014-11-29 17:58:40 -05:00
|
|
|
// params := erasure.ParseEncoderParams(10, 5, erasure.CAUCHY)
|
2014-11-29 16:18:52 -05:00
|
|
|
// encoder := erasure.NewEncoder(params)
|
|
|
|
// originalData, err := encoder.Decode(encodedData, length)
|
|
|
|
package erasure
|