splitter

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package splitter manages splitting of object data into chunks.

Index

Constants

View Source
const DefaultAlgorithm = "DYNAMIC-4M-BUZHASH"

DefaultAlgorithm is the name of the splitter used by default for new repositories.

Variables

This section is empty.

Functions

func SupportedAlgorithms

func SupportedAlgorithms() []string

SupportedAlgorithms returns the list of supported splitters.

Types

type Factory

type Factory func() Splitter

Factory creates instances of Splitter.

func Fixed

func Fixed(length int) Factory

Fixed returns a factory that creates splitters with fixed chunk length.

func GetFactory

func GetFactory(name string) Factory

GetFactory gets splitter factory with a specified name or nil if not found.

func Pooled added in v0.6.0

func Pooled(f Factory) Factory

Pooled returns a factory that recycles the splitters on Close().

type Splitter

type Splitter interface {
	// NextSplitPoint() determines the location of the next split point in the given slice of bytes.
	// It returns value `n` between 1..len(b) if a split point happens AFTER byte n and the splitter
	// has consumed `n` bytes.
	// If there is no split point, the splitter returns -1 and consumes all bytes from the slice.
	NextSplitPoint(b []byte) int
	MaxSegmentSize() int
	Reset()
	Close()
}

Splitter determines when to split a given object.

Jump to

Keyboard shortcuts

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