compression

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec interface {
	// Compress compresses given block.
	Compress(block []byte) ([]byte, error)
	// Decompress decompresses given block.
	Decompress(block []byte) ([]byte, error)
	// GetID returns codec identifier.
	GetID() CodecID
}

Codec is a generic interface for compression/decompression.

func NewCodec

func NewCodec(id CodecID) Codec

NewCodec creates codec by id.

type CodecBrotli

type CodecBrotli int

func (CodecBrotli) Compress

func (c CodecBrotli) Compress(block []byte) ([]byte, error)

func (CodecBrotli) Decompress

func (c CodecBrotli) Decompress(block []byte) ([]byte, error)

func (CodecBrotli) GetID

func (c CodecBrotli) GetID() CodecID

type CodecID

type CodecID int8

CodecID is a type that holds all available codec types.

const (
	CodecIDNone CodecID = 0

	CodecIDSnappy CodecID = 1

	CodecIDLz4                CodecID = 4
	CodecIDLz4HighCompression CodecID = 5

	CodecIDBrotli1  CodecID = 11
	CodecIDBrotli2  CodecID = 12
	CodecIDBrotli3  CodecID = 8
	CodecIDBrotli4  CodecID = 13
	CodecIDBrotli5  CodecID = 9
	CodecIDBrotli6  CodecID = 14
	CodecIDBrotli7  CodecID = 15
	CodecIDBrotli8  CodecID = 10
	CodecIDBrotli9  CodecID = 16
	CodecIDBrotli10 CodecID = 17
	CodecIDBrotli11 CodecID = 18

	CodecIDZlib1 CodecID = 19
	CodecIDZlib2 CodecID = 20
	CodecIDZlib3 CodecID = 21
	CodecIDZlib4 CodecID = 22
	CodecIDZlib5 CodecID = 23
	CodecIDZlib6 CodecID = 2
	CodecIDZlib7 CodecID = 24
	CodecIDZlib8 CodecID = 25
	CodecIDZlib9 CodecID = 3

	CodecIDZstd1 CodecID = 26
	CodecIDZstd3 CodecID = 28
	CodecIDZstd7 CodecID = 32
)

func (CodecID) String

func (i CodecID) String() string

type CodecLz4

type CodecLz4 struct{}

func (*CodecLz4) Compress

func (c *CodecLz4) Compress(block []byte) ([]byte, error)

func (*CodecLz4) Decompress

func (c *CodecLz4) Decompress(block []byte) ([]byte, error)

func (*CodecLz4) GetID

func (c *CodecLz4) GetID() CodecID

type CodecLz4HighCompression

type CodecLz4HighCompression struct{}

func (*CodecLz4HighCompression) Compress

func (c *CodecLz4HighCompression) Compress(block []byte) ([]byte, error)

func (*CodecLz4HighCompression) Decompress

func (c *CodecLz4HighCompression) Decompress(block []byte) ([]byte, error)

func (*CodecLz4HighCompression) GetID

func (c *CodecLz4HighCompression) GetID() CodecID

type CodecNone

type CodecNone struct{}

CodecNone is a special codec that does not any compression.

func (CodecNone) Compress

func (c CodecNone) Compress(block []byte) ([]byte, error)

Compress returns block as is.

func (CodecNone) Decompress

func (c CodecNone) Decompress(block []byte) ([]byte, error)

Decompress returns block as is.

func (CodecNone) GetID

func (c CodecNone) GetID() CodecID

type CodecSnappy

type CodecSnappy struct{}

func (*CodecSnappy) Compress

func (c *CodecSnappy) Compress(block []byte) ([]byte, error)

func (*CodecSnappy) Decompress

func (c *CodecSnappy) Decompress(block []byte) ([]byte, error)

func (*CodecSnappy) GetID

func (c *CodecSnappy) GetID() CodecID

type CodecZlib

type CodecZlib int

func (CodecZlib) Compress

func (c CodecZlib) Compress(block []byte) ([]byte, error)

func (CodecZlib) Decompress

func (c CodecZlib) Decompress(block []byte) ([]byte, error)

func (CodecZlib) GetID

func (c CodecZlib) GetID() CodecID

type CodecZstd

type CodecZstd int

func (CodecZstd) Compress

func (c CodecZstd) Compress(block []byte) ([]byte, error)

func (CodecZstd) Decompress

func (c CodecZstd) Decompress(block []byte) ([]byte, error)

func (CodecZstd) GetID

func (c CodecZstd) GetID() CodecID

Jump to

Keyboard shortcuts

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