compression

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0 Imports: 13 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{}
)

maps of registered compressors by header ID and name. nolint:gochecknoglobals

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.

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.

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