internal

package
v5.30.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlgorithmPrefix

func AlgorithmPrefix(algo Algorithm) []byte

AlgorithmPrefix returns the prefix field of algo. This is a function instead of a public method so that it is only callable by code that is allowed to import this internal subpackage.

Types

type Algorithm

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

Algorithm is a compression algorithm that can be used for CompressStream.

func NewAlgorithm

func NewAlgorithm(name, nontrivialBaseVariantName string, prefix []byte, decompressor DecompressorFunc, compressor CompressorFunc) Algorithm

NewAlgorithm creates an Algorithm instance. nontrivialBaseVariantName is typically "". This function exists so that Algorithm instances can only be created by code that is allowed to import this internal subpackage.

func (Algorithm) BaseVariantName added in v5.30.0

func (c Algorithm) BaseVariantName() string

BaseVariantName returns the name of the “base variant” of the compression algorithm. It is either equal to Name() of the same algorithm, or equal to Name() of some other Algorithm (the “base variant”). This supports a single level of “is-a” relationship between compression algorithms, e.g. where "zstd:chunked" data is valid "zstd" data.

func (Algorithm) Name

func (c Algorithm) Name() string

Name returns the name for the compression algorithm.

type CompressorFunc

type CompressorFunc func(io.Writer, map[string]string, *int) (io.WriteCloser, error)

CompressorFunc writes the compressed stream to the given writer using the specified compression level. The caller must call Close() on the stream (even if the input stream does not need closing!).

func AlgorithmCompressor

func AlgorithmCompressor(algo Algorithm) CompressorFunc

AlgorithmCompressor returns the compressor field of algo. This is a function instead of a public method so that it is only callable by code that is allowed to import this internal subpackage.

type DecompressorFunc

type DecompressorFunc func(io.Reader) (io.ReadCloser, error)

DecompressorFunc returns the decompressed stream, given a compressed stream. The caller must call Close() on the decompressed stream (even if the compressed input stream does not need closing!).

func AlgorithmDecompressor

func AlgorithmDecompressor(algo Algorithm) DecompressorFunc

AlgorithmDecompressor returns the decompressor field of algo. This is a function instead of a public method so that it is only callable by code that is allowed to import this internal subpackage.

Jump to

Keyboard shortcuts

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