erasurecoding

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OriginalShards = common.ErasureCodingOriginalShards             // Number of original data shards.
	RecoveryShards = common.NumberOfValidators - OriginalShards     // Number of recovery data shards.
	ChunkShardSize = common.ErasureCodingChunkSize / OriginalShards // In bytes.
)

These parameters allow data to be retrieved even when only 1/3 of the validators are available.

Variables

This section is empty.

Functions

func Decode

func Decode(shards [][]byte, outSize int) ([]byte, error)

Decode reconstructs the original data from striped erasure-coded shards using Reed-Solomon decoding. It requires at least OriginalShards number of shards to successfully recover the data. Missing or corrupted shards can be passed as nil or empty byte slices. The outSize parameter specifies the expected length of the original data. Implements equation H.7 from the graypaper (v0.5.3).

func Encode

func Encode(data []byte) ([][]byte, error)

Encode transforms input data into striped erasure-coded shards using Reed-Solomon encoding. It splits the data into chunks of ChunkSize bytes, then generates OriginalShards + RecoveryShards total shards. If data cannot be evenly split it will be padded with zeros. The resulting shards can tolerate the loss of up to RecoveryShards number of shards while still being able to reconstruct the original data. Implements equation H.6 from the graypaper (v0.5.3).

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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