Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
A Decoder keeps track of all information needed to check the integrity of a set of data files, and possibly repair any missing/corrupted data files from the parity files (.P00, .P01, etc.).
func NewDecoder ¶
func NewDecoder(delegate DecoderDelegate, indexFile string) (*Decoder, error)
NewDecoder reads the given index file, which usually has a .PAR extension.
func (*Decoder) LoadFileData ¶
LoadFileData loads existing file data into memory.
func (*Decoder) LoadParityData ¶
LoadParityData searches for parity volumes and loads them into memory.
type DecoderDelegate ¶
type DecoderDelegate interface { OnHeaderLoad(headerInfo string) OnFileEntryLoad(i, n int, filename, entryInfo string) OnCommentLoad(comment []byte) OnDataFileLoad(i, n int, path string, byteCount int, corrupt bool, err error) OnDataFileWrite(i, n int, path string, byteCount int, err error) OnVolumeFileLoad(i uint64, path string, storedSetHash, computedSetHash [16]byte, dataByteCount int, err error) }
DecoderDelegate holds methods that are called during the decode process.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
An Encoder keeps track of all information needed to create parity volumes for a set of data files, and write them out to parity files (.PAR, .P00, .P01, etc.).
func NewEncoder ¶
func NewEncoder(delegate EncoderDelegate, filePaths []string, volumeCount int) (*Encoder, error)
NewEncoder creates an encoder with the given list of file paths, and with the given number of intended parity volumes.
func (*Encoder) ComputeParityData ¶
ComputeParityData computes the parity data for the files.
func (*Encoder) LoadFileData ¶
LoadFileData loads the file data into memory.