compress

package
v0.3.43 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressStringArray added in v0.3.30

func CompressStringArray(input []string, compressor Compressor) ([]byte, error)

func DecompressStringArray added in v0.3.30

func DecompressStringArray(input []byte, decompressor Decompressor) ([]string, error)

Types

type Compressor

type Compressor interface {
	// Compress compresses the byte array
	Compress(b []byte) ([]byte, error)
}

Compressor is a fast, single threaded compressor. This type allows us to reuse buffers etc for performance

type Decompressor

type Decompressor interface {
	// Decompress decompresses the byte array
	Decompress(b []byte) ([]byte, error)
}

Decompressor is a fast, single threaded compressor. This type allows us to reuse buffers etc for performance

type NoOpCompressor

type NoOpCompressor struct{}

NoOpCompressor is a Compressor that does nothing. Useful for tests.

func (*NoOpCompressor) Compress

func (c *NoOpCompressor) Compress(b []byte) ([]byte, error)

type NoOpDecompressor

type NoOpDecompressor struct{}

NoOpDecompressor is a DeCompressor that does nothing. Useful for tests.

func (*NoOpDecompressor) DeCompress

func (c *NoOpDecompressor) DeCompress(b []byte) ([]byte, error)

type ZlibCompressor

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

ZlibCompressor compresses to Zlib, which for KB size payloads seems more (cpu) efficient than the newer formats such as zstd. The compressor will only compress if the msg is greater than minCompressSize

func NewZlibCompressor

func NewZlibCompressor(minCompressSize int) (*ZlibCompressor, error)

func (*ZlibCompressor) Compress

func (c *ZlibCompressor) Compress(b []byte) ([]byte, error)

type ZlibDecompressor

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

ZlibDecompressor decompresses Zlib,

func NewZlibDecompressor

func NewZlibDecompressor() (*ZlibDecompressor, error)

func (*ZlibDecompressor) Decompress

func (d *ZlibDecompressor) Decompress(b []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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