Documentation
¶
Overview ¶
Package chunker cuts byte streams into content-defined chunks with a FastCDC-style normalised Gear hash.
A Profile fixes how bytes are cut, so every agent cutting with the same profile cuts identical bytes identically. A profile's target is a power of two 2^k from 64 KiB to 1 MiB; chunks are cut from a quarter of it to four times it. The gear table entry for byte value v is the first eight bytes, big-endian, of SHA-256 of the single byte v. The masks have k+1 (below the target) and k-1 (above it) one bits at every third position from the top of the 64-bit fingerprint.
Index ¶
Constants ¶
const ( // DefaultTarget is the target chunk size of the zero Profile. DefaultTarget = 64 << 10 // MaxTarget is the largest target a Profile takes. MaxTarget = 1 << 20 // SmallestChunk is the smallest chunk any profile cuts before the end // of a stream. SmallestChunk = DefaultTarget / 4 // LargestChunk is the largest chunk any profile cuts. LargestChunk = 4 * MaxTarget )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FastCDC ¶
type FastCDC struct {
Profile Profile
// contains filtered or unexported fields
}
FastCDC holds the fingerprint of the chunk currently being scanned with its Profile.
type Profile ¶ added in v1.124.0
type Profile uint32
Profile is how a store cuts content: its target chunk size in bytes. The zero Profile cuts with DefaultTarget.
func NewProfile ¶ added in v1.124.0
NewProfile returns the profile of target, a power of two from DefaultTarget to MaxTarget; 0 is the default.