Documentation ¶
Overview ¶
Package chunks provides the basic structure for a pair of the weak and strong checksums. Since this is fairly widely used, splitting this out breaks a number of possible circular dependencies
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPartialChecksum = errors.New("Reader length was not a multiple of the checksums")
Functions ¶
This section is empty.
Types ¶
type ChunkChecksum ¶
type ChunkChecksum struct { // an offset in terms of chunk count ChunkOffset uint // the size of the block Size int64 WeakChecksum []byte StrongChecksum []byte }
For a given Block, the Weak & Strong hashes, and the offset This structure is only used to generate the index of reference files, since computing the strong checksum is not done when comparing unless the weak checksum matches
func LoadChecksumsFromReader ¶
func LoadChecksumsFromReader( r io.Reader, weakHashSize int, strongHashSize int, ) ([]ChunkChecksum, error)
Loads chunks from a reader, assuming alternating weak then strong hashes
func (ChunkChecksum) Match ¶
func (chunk ChunkChecksum) Match(other ChunkChecksum) bool
compares a checksum to another based on the checksums, not the offset
type StrongChecksumGetter ¶
type StrongChecksumGetter []ChunkChecksum
satisfies filechecksum.ChecksumLookup
func (StrongChecksumGetter) GetStrongChecksumForBlock ¶
func (s StrongChecksumGetter) GetStrongChecksumForBlock(blockID int) []byte
Click to show internal directories.
Click to hide internal directories.