compressor

package
v1.59.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Overview

Package rollsum implements rolling checksums similar to apenwarr's bup, which is similar to librsync.

The bup project is at https://github.com/apenwarr/bup and its splitting in particular is at https://github.com/apenwarr/bup/blob/master/lib/bup/bupsplit.c

Index

Constants

View Source
const (
	RollsumBits = 16
)

Variables

This section is empty.

Functions

func NoCompression added in v1.59.0

func NoCompression(r io.Writer, metadata map[string]string) (io.WriteCloser, error)

NoCompression writes directly to the output file without any compression

Such an output does not follow the zstd:chunked spec and cannot be generally consumed; this function only exists for internal purposes and should not be called from outside c/storage.

func ZstdCompressor

func ZstdCompressor(r io.Writer, metadata map[string]string, level *int) (io.WriteCloser, error)

ZstdCompressor is a CompressorFunc for the zstd compression algorithm.

Types

type RollSum

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

func NewRollSum

func NewRollSum() *RollSum

func (*RollSum) Bits

func (rs *RollSum) Bits() int

func (*RollSum) Digest

func (rs *RollSum) Digest() uint32

func (*RollSum) OnSplit

func (rs *RollSum) OnSplit() bool

OnSplit reports whether at least 13 consecutive trailing bits of the current checksum are set the same way.

func (*RollSum) OnSplitWithBits

func (rs *RollSum) OnSplitWithBits(n uint32) bool

OnSplitWithBits reports whether at least n consecutive trailing bits of the current checksum are set the same way.

func (*RollSum) Roll

func (rs *RollSum) Roll(ch byte)

Roll adds ch to the rolling sum.

Jump to

Keyboard shortcuts

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