goerasure

package
v0.0.0-...-5b4b798 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2022 License: Apache-2.0, BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package goerasure wraps the Jerasure C library in a Go object oriented interface that allows the user to perform erasure coding operations in Go using various erasure codes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAndPrint

func CreateAndPrint(r, c, w int)

Create and print a matrix in GF(2^w)

func Decode

func Decode(stripeName string, code Coder) (err error)

func Encode

func Encode(stripeName string, code Coder) (err error)

The Encode function takes in a stripe name, where the stripe name is the base name of a stripe of data blocks. It then encodes the data blocks with the specified coder and writes the coding blocks to disc.

func PrintMatrix

func PrintMatrix(matrix []int, r, c, w int)

PrintMatrix prints the contents of a coding matrix.

Types

type BlockWriter

type BlockWriter interface {
	Data(buf [][]byte)
	Coding(buf [][]byte)
	WriteData() error
	WriteCoding() error
	WriteErased(erasures []int) error
}

type Coder

type Coder interface {
	// Encode data and produce parity for the given code.
	Encode(data, coding [][]byte)
	// Decode data and parity with the specified erasures taken into
	// account for the given code.
	Decode(data, coding [][]byte, erasures []int)
	// ValidateCode ensures that the coding parameters follow the
	// specific code's requirements.
	ValidateCode()
	// PrintInfo prints the coding parameters.
	PrintInfo()
	// Ensure that the file size is compatible with the coding parameters.
	CheckFileSize(size int64)
	// K retrieves the number of data blocks.
	K() int
	// M retrueves the number of parity blocks.
	M() int
	// Buffersize retrieves the buffer size
	Buffersize() int64
}

Coder impliments the interface that is used to endode and decode data. It also implements validity checking across codes and getter methods that allow for the retrieval of required variables.

func NewBlaumRothCode

func NewBlaumRothCode(k, m, w, packetSize int, bufferSize int64) Coder

NewBlaumRothCode returns a type of bitmatrix code with both the bitmatrix and schedule initialised.

func NewCauchyGoodCode

func NewCauchyGoodCode(k, m, w, packetSize int, bufferSize int64) Coder

NewCaucheGoodCode returns a type of bitmatrix code with both the bitmatrix and schedule initialised.

func NewCauchyOrigCode

func NewCauchyOrigCode(k, m, w, packetSize int, bufferSize int64) Coder

NewCaucheOrigCode returns a type of bitmatrix code with both the bitmatrix and schedule initialised.

func NewLiber8tionCode

func NewLiber8tionCode(k, m, w, packetSize int, bufferSize int64) Coder

NewLiber8tionCode returns a type of bitmatrix code with both the bitmatrix and schedule initialised.

func NewLiberationCode

func NewLiberationCode(k, m, w, packetSize int, bufferSize int64) Coder

NewLiberationCode returns a type of bitmatrix code with both the bitmatrix and schedule initialised.

func NewReedSolVanCode

func NewReedSolVanCode(k, m, w, packetSize int, bufferSize int64) Coder

NewReedSolVanCode returns a Reed-Solomon code, and initialising the coding matrix to a Vandermonde matrix

type LenReader

type LenReader interface {
	io.Reader
	Len() int64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL