chunking

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DerivePolynomial

func DerivePolynomial(rng io.Reader) rabinkarp64.Pol

Types

type ChunkHandler

type ChunkHandler = func([]byte) error

ChunkHandler is the type of the function called to recieve chunks. the buffer should not be used outside of the function call.

type Chunker

type Chunker interface {
	// Write writes bytes to the chunker, chunks can be produced anywhere in the slice
	Write(p []byte) (int, error)
	// Buffered returns the number of bytes buffered, but not yet made into a chunk.
	Buffered() int
	// Flush forces the production of a chunk, if there is any buffered data.
	Flush() error
}

Chunker is the common interface exposed by chunkers

type ContentDefined

type ContentDefined struct {
	// contains filtered or unexported fields
}

func NewContentDefined

func NewContentDefined(minSize, avgSize, maxSize int, pol rabinkarp64.Pol, onChunk func(data []byte) error) *ContentDefined

func (*ContentDefined) Buffered

func (c *ContentDefined) Buffered() int

func (*ContentDefined) Flush

func (c *ContentDefined) Flush() error

func (*ContentDefined) Reset

func (c *ContentDefined) Reset()

func (*ContentDefined) Write

func (c *ContentDefined) Write(data []byte) (int, error)

func (*ContentDefined) WriteByte

func (c *ContentDefined) WriteByte(b byte) error

type Exponential

type Exponential struct {
	// contains filtered or unexported fields
}

func NewExponential

func NewExponential(minSize, maxSize, period int, fn ChunkHandler) *Exponential

func (*Exponential) Buffered

func (e *Exponential) Buffered() int

func (*Exponential) Flush

func (e *Exponential) Flush() error

func (*Exponential) Reset

func (e *Exponential) Reset()

func (*Exponential) Write

func (e *Exponential) Write(data []byte) (int, error)

Jump to

Keyboard shortcuts

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