compression

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Overview

Package compression manages compression algorithm implementations.

Index

Constants

This section is empty.

Variables

View Source
var (
	ByHeaderID     = map[HeaderID]Compressor{}
	ByName         = map[Name]Compressor{}
	HeaderIDToName = map[HeaderID]Name{}
	IsDeprecated   = map[Name]bool{}
)

maps of registered compressors by header ID and name.

Functions

func DecompressByHeader added in v0.9.0

func DecompressByHeader(output io.Writer, input io.Reader) error

DecompressByHeader decodes compression header from the provided input and decompresses the remainder.

func RegisterCompressor

func RegisterCompressor(name Name, c Compressor)

RegisterCompressor registers the provided compressor implementation.

func RegisterDeprecatedCompressor added in v0.11.0

func RegisterDeprecatedCompressor(name Name, c Compressor)

RegisterDeprecatedCompressor registers the provided compressor implementation.

Types

type Compressor

type Compressor interface {
	HeaderID() HeaderID
	Compress(output io.Writer, input io.Reader) error
	Decompress(output io.Writer, input io.Reader, withHeader bool) error
}

Compressor implements compression and decompression of a byte slice.

type HeaderID

type HeaderID uint32

HeaderID is a unique identifier of the compressor stored in the compressed block header.

const (
	HeaderZstdDefault           HeaderID = 0x1100
	HeaderZstdFastest           HeaderID = 0x1101
	HeaderZstdBetterCompression HeaderID = 0x1102
	HeaderZstdBestCompression   HeaderID = 0x1103
)

defined header IDs.

type Name

type Name string

Name is the name of the compressor to use.

Jump to

Keyboard shortcuts

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