Documentation
¶
Overview ¶
Package erasurecode provides an implementation of Reed-Solomon erasure coding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErasureCode ¶
type ErasureCode struct {
DataBlocks int
ParityBlocks int
// contains filtered or unexported fields
}
ErasureCode is a wrapper around the reedsolomon.Encoder type, providing a more user-friendly interface.
func New ¶
func New(dataBlocks, parityBlocks int) (*ErasureCode, error)
New creates a new ErasureEncode instance with the specified number of data and parity shards.
func (*ErasureCode) Encode ¶
func (e *ErasureCode) Encode(data []byte) ([]byte, error)
Encode encodes the input data using Reed-Solomon erasure coding, returning the encoded data.
func (*ErasureCode) ExtractData ¶
func (e *ErasureCode) ExtractData(blocks [][]byte, originalSize int) ([]byte, error)
ExtractData extracts the original data from the encoded data using Reed-Solomon erasure coding. TODO: remove doUnwrap once migration is completed.
func (*ErasureCode) ReconstructAll ¶
func (e *ErasureCode) ReconstructAll(blocks [][]byte) error
ReconstructAll reconstructs all missing blocks using Reed-Solomon erasure coding.
Click to show internal directories.
Click to hide internal directories.