fastcdc

package module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: ISC Imports: 3 Imported by: 0

README

go-fastcdc

go-fastcdc is a Golang package implementing the fastCDC chunking algorithm.

    chunkerOpts := fastcdc.NewChunkerOpts()
    chunkerOpts.NormalSize = 8 * 1024,   // 8KB

    chunker, err := fastcdc.NewChunker(rd, chunkerOpts)
    if err != nil {
        log.Fatal(err)
    }

    for {
        chunk, err := chunker.Next()
        if err != nil {
            if err == io.EOF {
                // no more chunks to read
                break
            }
            log.Fatal(err)
        }

        fmt.Println(chunk.Offset, chunk.Size)
        // data is in chunk.Data
    }

Reference

Documentation

Index

Constants

This section is empty.

Variables

View Source
var G [256]uint64 = [256]uint64{}/* 256 elements not displayed */

randomly generated Gear table

Functions

This section is empty.

Types

type Chunker

type Chunker struct {
	NormalSize uint32
	MinSize    uint32
	MaxSize    uint32
	// contains filtered or unexported fields
}

func NewChunker

func NewChunker(reader io.Reader, options *ChunkerOpts) (*Chunker, error)

func (*Chunker) Next

func (chunker *Chunker) Next() ([]byte, error)

type ChunkerOpts

type ChunkerOpts struct {
	NormalSize uint32
	MinSize    uint32
	MaxSize    uint32
}

func NewChunkerOptions

func NewChunkerOptions() *ChunkerOpts

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL