This package provides various CDC methods in Go.
Currently implemented:
- Rabin chunking method
- Gear-based chunking
- All work is done through
Chunker
interface.Next
method should returnnil
error iff a new chunk was consumed. Errors from underlying reader are returns unchanged exceptio.ErrUnexpectedEOF
which is replaced withio.EOF
. - All chunkers are well-behaved in a sense that they don't use underlying
Reader
after encountering any error.
As simple as it seems:
r := bytes.NewReader(buf)
ch := NewRabin()
ch.Reset(r)
for chunk, err := r.Next(nil); err != nil {
// process chunk
}
Next
method can be provided with pre-allocated buffer for storing chunk data.
- implement all methods from https://www.usenix.org/system/files/conference/atc16/atc16-paper-xia.pdf
- implement
HashedChunk
parametrised byhash.Hash
for calculating cryptographic checksum of returned chunks