Documentation ¶
Index ¶
Constants ¶
View Source
const ( // BlockOverhead specifies the number of extra bytes required to encode a // block of data. BlockOverhead = sha256.Size )
Variables ¶
This section is empty.
Functions ¶
func NewReadSeeker ¶
func NewReadSeeker(encoder *Encoder, shards []io.ReadSeeker, outSize int64) io.ReadSeeker
NewReadSeeker returns a new ReaderSeeker
Types ¶
type Encoder ¶
type Encoder struct { DataShards int ParityShards int BlockSize int // contains filtered or unexported fields }
Encoder encodes Reed-Solomon parity sets from a stream of unknown length.
func NewEncoder ¶
type ErrCorruptionDetected ¶
type ErrCorruptionDetected struct {
BlockCount int
}
func (ErrCorruptionDetected) Error ¶
func (e ErrCorruptionDetected) Error() string
type ReadSeeker ¶
type ReadSeeker struct {
// contains filtered or unexported fields
}
ReadSeeker implements the io.ReadSeeker interface for Reed-Solomon encoded shards.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func (*Writer) Write ¶
Write splits the data into the number of shards given to it, and writes the shards to the writers. Note that the caller must keep track of the following metadata in order to correctly reconstruct the data:
* The number of data shards * The number of parity shards * The block size * The size of the original data * The order of the shards
This function also adds a sha256 hash every `blockSize` bytes.
Click to show internal directories.
Click to hide internal directories.