compression

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 2 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Algorithm

type Algorithm interface {
	Compress(value []byte) ([]byte, error)
	Decompress(value []byte) ([]byte, error)
	Accept(alg string) bool
	Close() error
}

Algorithm defines compression/decompression algorithm functionality.

type Option

type Option func(opts *Registry)

Option is a registry instance option.

func WithAlgorithm

func WithAlgorithm(alg Algorithm) Option

WithAlgorithm adds compression algorithm to the list of available algorithms.

func WithDefaultAlgorithms

func WithDefaultAlgorithms() Option

WithDefaultAlgorithms adds default compression algorithms to the list of available algorithms.

type Registry

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

Registry contains compression algorithms.

func New

func New(opts ...Option) *Registry

New return new instance of compression algorithm registry.

func (*Registry) Close

func (r *Registry) Close() error

Close frees resources being maintained by compression algorithm.

func (*Registry) Compress

func (r *Registry) Compress(alg string, data []byte) ([]byte, error)

Compress data using specified algorithm.

func (*Registry) Decompress

func (r *Registry) Decompress(alg string, data []byte) ([]byte, error)

Decompress will decompress compressed data using specified algorithm.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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