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 (that usually end in .par2).
func NewDecoder ¶
func NewDecoder(delegate DecoderDelegate, indexFile string, numGoroutines int) (*Decoder, error)
NewDecoder reads the given index file, which usually has a .par2 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 { OnCreatorPacketLoad(clientID string) OnMainPacketLoad(sliceByteCount, recoverySetCount, nonRecoverySetCount int) OnFileDescriptionPacketLoad(fileID [16]byte, filename string, byteCount int) OnIFSCPacketLoad(fileID [16]byte) OnRecoveryPacketLoad(exponent uint16, byteCount int) OnUnknownPacketLoad(packetType [16]byte, byteCount int) OnOtherPacketSkip(setID [16]byte, packetType [16]byte, byteCount int) OnDataFileLoad(i, n int, path string, byteCount, hits, misses int, err error) OnParityFileLoad(i int, path string, err error) OnDetectCorruptDataChunk(fileID [16]byte, filename string, startByteOffset, endByteOffset int) OnDetectDataFileHashMismatch(fileID [16]byte, filename string) OnDetectDataFileWrongByteCount(fileID [16]byte, filename string) OnDataFileWrite(i, n int, path string, byteCount 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 (that usually end in .par2).
func NewEncoder ¶
func NewEncoder(delegate EncoderDelegate, filePaths []string, sliceByteCount, parityShardCount, numGoroutines 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.
type EncoderDelegate ¶
type EncoderDelegate interface { OnDataFileLoad(i, n int, path string, byteCount int, err error) OnIndexFileWrite(path string, byteCount int, err error) OnRecoveryFileWrite(start, count, total int, path string, dataByteCount, byteCount int, err error) }
EncoderDelegate holds methods that are called during the encode process.