strategy

package
v0.55.0-devel Latest Latest
Warning

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

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

Documentation

Overview

Package strategy provides a set of functions for compressing with zlib / zstd

Package strategy provides a set of functions for compressing with zlib / zstd

Package strategy provides a set of functions for compressing with zlib / zstd

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NoopStrategy

type NoopStrategy struct {
}

NoopStrategy is the strategy for when serializer_compressor_kind is neither zlib nor zstd

func NewNoopStrategy

func NewNoopStrategy() *NoopStrategy

NewNoopStrategy returns a new NoopStrategy for when kind is neither zlib nor zstd

func (*NoopStrategy) Compress

func (s *NoopStrategy) Compress(src []byte) ([]byte, error)

Compress implements the Compress method for NoopStrategy to satisfy the Compressor interface

func (*NoopStrategy) CompressBound

func (s *NoopStrategy) CompressBound(sourceLen int) int

CompressBound implements the CompressBound method for NoopStrategy to satisfy the Compressor interface

func (*NoopStrategy) ContentEncoding

func (s *NoopStrategy) ContentEncoding() string

ContentEncoding implements the ContentEncoding method for NoopStrategy to satisfy the Compressor interface

func (*NoopStrategy) Decompress

func (s *NoopStrategy) Decompress(src []byte) ([]byte, error)

Decompress implements the Decompress method for NoopStrategy to satisfy the Compressor interface

func (*NoopStrategy) NewStreamCompressor

func (s *NoopStrategy) NewStreamCompressor(_ *bytes.Buffer) compression.StreamCompressor

NewStreamCompressor returns a nil when there is no compression implementation.

type ZlibStrategy

type ZlibStrategy struct {
}

ZlibStrategy is the strategy for when serializer_compressor_kind is zlib

func NewZlibStrategy

func NewZlibStrategy() *ZlibStrategy

NewZlibStrategy returns a new ZlibStrategy

func (*ZlibStrategy) Compress

func (s *ZlibStrategy) Compress(src []byte) ([]byte, error)

Compress will compress the data with zlib

func (*ZlibStrategy) CompressBound

func (s *ZlibStrategy) CompressBound(sourceLen int) int

CompressBound returns the worst case size needed for a destination buffer This is allowed to return a value _larger_ than 'sourceLen'. Ref: https://refspecs.linuxbase.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/zlib-compressbound-1.html

func (*ZlibStrategy) ContentEncoding

func (s *ZlibStrategy) ContentEncoding() string

ContentEncoding returns the content encoding value for zlib

func (*ZlibStrategy) Decompress

func (s *ZlibStrategy) Decompress(src []byte) ([]byte, error)

Decompress will decompress the data with zlib

func (*ZlibStrategy) NewStreamCompressor

func (s *ZlibStrategy) NewStreamCompressor(output *bytes.Buffer) compression.StreamCompressor

NewStreamCompressor returns a new zlib writer

type ZstdStrategy

type ZstdStrategy struct {
}

ZstdStrategy is the strategy for when serializer_compressor_kind is zstd

func NewZstdStrategy

func NewZstdStrategy() *ZstdStrategy

NewZstdStrategy returns a new ZstdStrategy

func (*ZstdStrategy) Compress

func (s *ZstdStrategy) Compress(src []byte) ([]byte, error)

Compress will compress the data with zstd

func (*ZstdStrategy) CompressBound

func (s *ZstdStrategy) CompressBound(sourceLen int) int

CompressBound returns the worst case size needed for a destination buffer when using zstd

func (*ZstdStrategy) ContentEncoding

func (s *ZstdStrategy) ContentEncoding() string

ContentEncoding returns the content encoding value for zstd

func (*ZstdStrategy) Decompress

func (s *ZstdStrategy) Decompress(src []byte) ([]byte, error)

Decompress will decompress the data with zstd

func (*ZstdStrategy) NewStreamCompressor

func (s *ZstdStrategy) NewStreamCompressor(output *bytes.Buffer) compression.StreamCompressor

NewStreamCompressor returns a new zstd Writer

Jump to

Keyboard shortcuts

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