zstd

package
v0.112.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const NamePrefix = "zstdarrow"

NamePrefix is prefix, with N for compression level.

Variables

View Source
var TTL = time.Minute

TTL is modified in testing.

Functions

func SetDecoderConfig

func SetDecoderConfig(cfg DecoderConfig) error

func SetEncoderConfig

func SetEncoderConfig(cfg EncoderConfig) error

Types

type DecoderConfig

type DecoderConfig struct {
	// MemoryLimitMiB is a memory limit control for the decoder,
	// as a way to limit overall memory use by Zstd.
	// See `zstdlib.WithDecoderMaxMemory()`.
	MemoryLimitMiB uint32 `mapstructure:"memory_limit_mib"`
	// MaxWindowSizeMiB limits window sizes that can be configured
	// in the corresponding encoder's `EncoderConfig.WindowSizeMiB`
	// setting, as a way to control memory usage.
	// See `zstdlib.WithDecoderMaxWindow()`.
	MaxWindowSizeMiB uint32 `mapstructure:"max_window_size_mib"`
	// Concurrency is a Zstd-library parameter that configures the
	// use of background goroutines to improve decompression speed.
	// 0 means to let the library decide (it will use up to GOMAXPROCS),
	// and 1 means to avoid background workers.  (default: 1)
	// See `zstdlib.WithDecoderConcurrency()`.
	Concurrency uint `mapstructure:"concurrency"`
}

func DefaultDecoderConfig

func DefaultDecoderConfig() DecoderConfig

func (DecoderConfig) Validate

func (cfg DecoderConfig) Validate() error

type EncoderConfig

type EncoderConfig struct {
	// Level is meaningful in the range [0, 10].  No invalid
	// values, they all map into 4 default configurations.  (default: 5)
	// See `zstdlib.WithEncoderLevel()`.
	Level Level `mapstructure:"level"`
	// WindowSizeMiB is a Zstd-library parameter that controls how
	// much window of text is visible to the compressor at a time.
	// It is the dominant factor that determines memory usage.
	// If zero, the window size is determined by level.  (default: 0)
	// See `zstdlib.WithWindowSize()`.
	WindowSizeMiB uint32 `mapstructure:"window_size_mib"`
	// Concurrency is a Zstd-library parameter that configures the
	// use of background goroutines to improve compression speed.
	// 0 means to let the library decide (it will use up to GOMAXPROCS),
	// and 1 means to avoid background workers.  (default: 1)
	// See `zstdlib.WithEncoderConcurrency()`.
	Concurrency uint `mapstructure:"concurrency"`
}

func DefaultEncoderConfig

func DefaultEncoderConfig() EncoderConfig

func (EncoderConfig) CallOption

func (cfg EncoderConfig) CallOption() grpc.CallOption

func (EncoderConfig) Name

func (cfg EncoderConfig) Name() string

func (EncoderConfig) Validate

func (cfg EncoderConfig) Validate() error

type Gen

type Gen time.Time

Gen is the reset time.

type Level

type Level uint

Level is an integer value mapping to compression level. [0] implies disablement; not registered in grpc [1,2] fastest i.e., "zstdarrow1", "zstdarrow2" [3-5] default [6-9] better [10] best.

const (
	// DefaultLevel is a reasonable balance of compression and cpu usage.
	DefaultLevel Level = 5
	// MinLevel is fast and cheap.
	MinLevel Level = 1
	// MaxLevel is slow and expensive.
	MaxLevel Level = 10
)

Jump to

Keyboard shortcuts

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