Documentation
¶
Overview ¶
Package compress provides Zstd compression middleware for Trove. It compresses data on write and decompresses on read, with configurable minimum size thresholds and skip lists for already-compressed formats.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compress ¶
type Compress struct {
// contains filtered or unexported fields
}
Compress provides Zstd compression middleware.
func (*Compress) Direction ¶
func (c *Compress) Direction() middleware.Direction
Direction returns ReadWrite since compression participates in both paths.
func (*Compress) WrapReader ¶
func (c *Compress) WrapReader(_ context.Context, r io.ReadCloser, _ *driver.ObjectInfo) (io.ReadCloser, error)
WrapReader wraps a reader to decompress data on read. It detects the zstd magic bytes to determine if decompression is needed.
func (*Compress) WrapWriter ¶
func (c *Compress) WrapWriter(_ context.Context, w io.WriteCloser, key string) (io.WriteCloser, error)
WrapWriter wraps a writer to compress data before writing. Data is buffered, then compressed and written on Close.
type Option ¶
type Option func(*Compress)
Option configures the Compress middleware.
func WithExclude ¶
WithExclude adds file extensions to skip (already compressed formats).
func WithMinSize ¶
WithMinSize sets the minimum object size to compress. Objects smaller than this are passed through uncompressed.