compressor

package
v1.180.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKind = errors.New("invalid kind")

ErrInvalidKind for compressor.

Module for fx.

Functions

This section is empty.

Types

type Compressor

type Compressor interface {
	// Compress data.
	Compress(data []byte) []byte

	// Decompress data.
	Decompress(data []byte) ([]byte, error)
}

Compressor allows to have different ways to compress/decompress.

type Factory added in v1.156.0

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

Factory of compressor.

func NewFactory added in v1.156.0

func NewFactory() *Factory

NewFactory for compressor.

func (*Factory) Create added in v1.156.0

func (f *Factory) Create(kind string) (Compressor, error)

Create from kind.

func (*Factory) Register added in v1.156.0

func (f *Factory) Register(kind string, c Compressor)

Register kind and compressor.

type None added in v1.157.0

type None struct{}

None for compressor.

func NewNone added in v1.157.0

func NewNone() *None

NewNone compressor.

func (*None) Compress added in v1.157.0

func (c *None) Compress(data []byte) []byte

func (*None) Decompress added in v1.157.0

func (c *None) Decompress(data []byte) ([]byte, error)

type S2 added in v1.175.0

type S2 struct{}

S2 for compressor.

func NewS2 added in v1.175.0

func NewS2() *S2

NewS2 compressor.

func (*S2) Compress added in v1.175.0

func (c *S2) Compress(data []byte) []byte

func (*S2) Decompress added in v1.175.0

func (c *S2) Decompress(data []byte) ([]byte, error)

type Snappy added in v1.156.0

type Snappy struct{}

Snappy for compressor.

func NewSnappy

func NewSnappy() *Snappy

NewSnappy compressor.

func (*Snappy) Compress added in v1.156.0

func (c *Snappy) Compress(data []byte) []byte

func (*Snappy) Decompress added in v1.156.0

func (c *Snappy) Decompress(data []byte) ([]byte, error)

type Zstd added in v1.175.0

type Zstd struct{}

Zstd for compressor.

func NewZstd added in v1.175.0

func NewZstd() *Zstd

NewZstd compressor.

func (*Zstd) Compress added in v1.175.0

func (c *Zstd) Compress(data []byte) []byte

func (*Zstd) Decompress added in v1.175.0

func (c *Zstd) Decompress(data []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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