Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedCompression = errors.New("unsupported compression type")
ErrUnsupportedCompression is returned when an unsupported compression type is requested
Functions ¶
This section is empty.
Types ¶
type Compressor ¶
type Compressor interface {
// Compress compresses the input data
Compress(data []byte, level int) ([]byte, error)
// Extension returns the file extension for this compression (e.g., ".zst", ".lz4", ".gz")
Extension() string
// DefaultLevel returns the default compression level
DefaultLevel() int
}
Compressor defines the interface for compression handlers
func GetCompressor ¶
func GetCompressor(compression string) (Compressor, error)
GetCompressor returns the appropriate compressor based on the compression string
type GzipCompressor ¶
type GzipCompressor struct{}
GzipCompressor handles Gzip compression
func NewGzipCompressor ¶
func NewGzipCompressor() *GzipCompressor
NewGzipCompressor creates a new Gzip compressor
func (*GzipCompressor) Compress ¶
func (c *GzipCompressor) Compress(data []byte, level int) ([]byte, error)
Compress compresses data using Gzip
func (*GzipCompressor) DefaultLevel ¶
func (c *GzipCompressor) DefaultLevel() int
DefaultLevel returns the default compression level for Gzip
func (*GzipCompressor) Extension ¶
func (c *GzipCompressor) Extension() string
Extension returns the file extension for Gzip compression
type LZ4Compressor ¶
type LZ4Compressor struct{}
LZ4Compressor handles LZ4 compression
func NewLZ4Compressor ¶
func NewLZ4Compressor() *LZ4Compressor
NewLZ4Compressor creates a new LZ4 compressor
func (*LZ4Compressor) Compress ¶
func (c *LZ4Compressor) Compress(data []byte, level int) ([]byte, error)
Compress compresses data using LZ4
func (*LZ4Compressor) DefaultLevel ¶
func (c *LZ4Compressor) DefaultLevel() int
DefaultLevel returns the default compression level for LZ4
func (*LZ4Compressor) Extension ¶
func (c *LZ4Compressor) Extension() string
Extension returns the file extension for LZ4 compression
type NoneCompressor ¶
type NoneCompressor struct{}
NoneCompressor is a no-op compressor that returns data unchanged
func NewNoneCompressor ¶
func NewNoneCompressor() *NoneCompressor
NewNoneCompressor creates a new no-op compressor
func (*NoneCompressor) Compress ¶
func (c *NoneCompressor) Compress(data []byte, _ int) ([]byte, error)
Compress returns the data unchanged (no compression)
func (*NoneCompressor) DefaultLevel ¶
func (c *NoneCompressor) DefaultLevel() int
DefaultLevel returns 0 (no compression level needed)
func (*NoneCompressor) Extension ¶
func (c *NoneCompressor) Extension() string
Extension returns an empty string (no compression extension)
type ZstdCompressor ¶
type ZstdCompressor struct {
// contains filtered or unexported fields
}
ZstdCompressor handles Zstandard compression
func NewZstdCompressor ¶
func NewZstdCompressor() *ZstdCompressor
NewZstdCompressor creates a new Zstandard compressor
func (*ZstdCompressor) Compress ¶
func (c *ZstdCompressor) Compress(data []byte, level int) ([]byte, error)
Compress compresses data using Zstandard
func (*ZstdCompressor) DefaultLevel ¶
func (c *ZstdCompressor) DefaultLevel() int
DefaultLevel returns the default compression level for Zstandard
func (*ZstdCompressor) Extension ¶
func (c *ZstdCompressor) Extension() string
Extension returns the file extension for Zstandard compression
func (*ZstdCompressor) WithWorkers ¶
func (c *ZstdCompressor) WithWorkers(workers int) *ZstdCompressor
WithWorkers sets the number of workers for compression