erasurecode

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

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.

Jump to

Keyboard shortcuts

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