Documentation
¶
Overview ¶
Package jc implements the JC (Jump Condition) content-defined chunking algorithm.
This file is from https://raw.githubusercontent.com/PlakarKorp/go-cdc-chunkers/423839/chunkers/jc/jc.go and is licensed under the ISC license, shown above.
It has been modified to have a simplified API.
Index ¶
Constants ¶
View Source
const ( DefaultMinSize uint64 = 2 * 1024 // 2KB DefaultMaxSize uint64 = 64 * 1024 // 64KB DefaultTargetSize uint64 = 8 * 1024 // 8KB )
Default chunking parameters
Variables ¶
View Source
var ( ErrTargetSize = errors.New("TargetSize is required and must be 64B <= TargetSize <= 1GB") ErrMinSize = errors.New("MinSize is required and must be 64B <= MinSize <= 1GB && MinSize < TargetSize") ErrMaxSize = errors.New("MaxSize is required and must be 64B <= MaxSize <= 1GB && MaxSize > TargetSize") )
Functions ¶
Types ¶
type Chunk ¶
type Chunk struct {
// Start is the absolute position in the stream where this chunk begins
Start uint64
// Length is the length of the chunk
Length int
// Data contains the actual chunk data
Data []byte
}
Chunk represents a chunk of data with its position and data.
type Chunker ¶
type Chunker struct {
// contains filtered or unexported fields
}
Chunker wraps JC to provide streaming chunking functionality.
func NewChunker ¶
NewChunker creates a new streaming chunker with the default parameters.
func NewChunkerWithOptions ¶
func NewChunkerWithOptions(reader io.Reader, minSize, maxSize, targetSize uint64, key []byte) (*Chunker, error)
NewChunkerWithOptions creates a new streaming chunker with the given options.
type JC ¶
type JC struct {
G [gLen]uint64
// contains filtered or unexported fields
}
func NewWithOptions ¶
NewWithOptions constructs the JC with the given options.
Click to show internal directories.
Click to hide internal directories.