Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultNumGoroutines ¶
func DefaultNumGoroutines() int
DefaultNumGoroutines returns a default value for the numGoroutines parameter to pass into NewCoderCauchy and NewCoderPAR2Vandermonde. This is not necessarily GOMAXPROCS.
Types ¶
type Coder ¶
type Coder struct {
// contains filtered or unexported fields
}
A Coder is an object that can generate parity shards, verify parity shards, and reconstruct data shards from parity shards.
func NewCoderCauchy ¶
NewCoderCauchy returns a Coder that works with the given number of data and parity shards, using a Cauchy matrix.
func NewCoderPAR2Vandermonde ¶
NewCoderPAR2Vandermonde returns a Coder that works with the given number of data and parity shards, using a Vandermonde matrix as specified in the PAR2 spec. Note that this matrix is flawed, so ReconstructData may fail.
func (Coder) GenerateParity ¶
GenerateParity takes a list of data shards, which must have length matching the dataShards value passed into NewCoder, and which must have equal-sized byte slices with even length, and returns a list of parityShards parity shards.
func (Coder) ReconstructData ¶
ReconstructData takes a list of data shards and parity shards, some of which may be nil, and tries to reconstruct the missing data shards. If successful, the nil rows of data are filled in and a nil error is returned. Otherwise, an error is returned. In particular, if there are missing data shards but there aren't enough parity shards to reconstruct them, NotEnoughParityShardsError is returned.
type NotEnoughParityShardsError ¶
type NotEnoughParityShardsError struct{}
NotEnoughParityShardsError is returned by ReconstructData or if there isn't enough parity shards to reconstruct some missing data.
func (NotEnoughParityShardsError) Error ¶
func (NotEnoughParityShardsError) Error() string