package compress

import "github.com/ClickHouse/ch-go/compress"

Package compress implements compression support.

Index

Constants

const (
	None Method = iota
	LZ4
	LZ4HC
	ZSTD
	NumMethods int = iota
)

Possible compression methods.

Functions

func FormatU128

func FormatU128(v city.U128) string

FormatU128 formats city.U128 as hex.

func MethodStrings

func MethodStrings() []string

MethodStrings returns a slice of all String values of the enum

Types

type CorruptedDataErr

type CorruptedDataErr struct {
	Actual    city.U128
	Reference city.U128
	RawSize   int
	DataSize  int
}

CorruptedDataErr means that provided hash mismatch with calculated.

func (*CorruptedDataErr) Error

func (c *CorruptedDataErr) Error() string

type Level

type Level uint32

Level for supporting compression codecs.

const (
	LevelZero         Level = 0
	LevelLZ4HCDefault Level = 9
	LevelLZ4HCMax     Level = 12
)

type Method

type Method byte

Method is compression codec.

func MethodString

func MethodString(s string) (Method, error)

MethodString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func MethodValues

func MethodValues() []Method

MethodValues returns all values of the enum

func (Method) IsAMethod

func (i Method) IsAMethod() bool

IsAMethod returns "true" if the value is listed in the enum definition. "false" otherwise

func (Method) String

func (i Method) String() string

type Reader

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

Reader decodes compressed blocks.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns new *Reader from r.

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

Read implements io.Reader.

type Writer

type Writer struct {
	Data []byte
	// contains filtered or unexported fields
}

Writer encodes compressed blocks.

func NewWriter

func NewWriter(l Level, m Method) *Writer

NewWriter creates a new Writer with the specified compression level that supports the specified method.

func (*Writer) Compress

func (w *Writer) Compress(buf []byte) error

Compress buf into Data.

Source Files

compress.go method_enum.go reader.go writer.go

Version
v0.65.1 (latest)
Published
Feb 18, 2025
Platform
linux/amd64
Imports
9 packages
Last checked
now

Tools for package owners.