lz4

package
v4.1.14 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package lz4 implements goDB's Encoder interface for lz4 (de-)compression of flow data

Index

Constants

View Source
const (
	MaxCompressionLevel = 12 // MaxCompressionLevel denotes the maximum useful compression level

)

Variables

View Source
var (

	// ErrBufferSizeMismatch denotes that the allocated buffer is insufficient in size
	ErrBufferSizeMismatch = errors.New("buffer size mismatch for compressed data")

	// ErrIncorrectNumBytesRead denotes that the number of bytes read during decompression
	// does not match the expected size
	ErrIncorrectNumBytesRead = errors.New("incorrect number of bytes read from data source during decompression")
)

Functions

This section is empty.

Types

type Encoder

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

Encoder compresses data with the LZ4 algorithm (omitting certain bounds-checks for performance reasons)

func New

func New(opts ...Option) *Encoder

New creates a new LZ4 Encoder that can be used to compress/decompress data

func (*Encoder) Close

func (e *Encoder) Close() error

Close will close the encoder and release potentially allocated resources

func (*Encoder) Compress

func (e *Encoder) Compress(data, buf []byte, dst io.Writer) (n int, err error)

Compress compresses the input data and writes it to dst

func (*Encoder) Decompress

func (e *Encoder) Decompress(in, out []byte, src io.Reader) (int, error)

Decompress runs LZ4 decompression on "in" read from "src" and writes it to "out"

func (*Encoder) SetLevel

func (e *Encoder) SetLevel(level int)

SetLevel sets / changes the compression level (if supported)

func (*Encoder) Type

func (e *Encoder) Type() encoders.Type

Type will return the type of encoder

type Option

type Option func(*Encoder)

Option sets additional parameters on the Encoder

func WithCompressionLevel

func WithCompressionLevel(level int) Option

WithCompressionLevel allows the level to be set to something other than the default 512

Jump to

Keyboard shortcuts

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