Documentation
¶
Index ¶
Constants ¶
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 ¶
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 ¶
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.