Documentation ¶
Index ¶
Constants ¶
const ( ExtNone = "" ExtGZIP = ".gz" ExtSnappy = ".sz" ExtLZ4 = ".lz4" ExtFlate = ".zz" ExtZstd = ".zst" )
Variables ¶
This section is empty.
Functions ¶
func SupportedCodecs ¶
func SupportedCodecs() string
SupportedCodecs returns the list of supported Encoding.
func ToFileExtension ¶
Types ¶
type Codec ¶
type Codec byte
Codec identifies an available compression codec.
const ( None Codec = iota GZIP Dumb // not supported LZ4_64k Snappy LZ4_256k LZ4_1M LZ4_4M Flate Zstd )
The different available codecs Make sure to preserve the order, as the numeric values are serialized!
func FromFileExtension ¶
func ParseCodec ¶
ParseCodec parses a chunk encoding (compression codec) by its name.
type FlatePool ¶
type FlatePool struct {
// contains filtered or unexported fields
}
FlatePool is a flate compression pool
func (*FlatePool) GetReader ¶
GetReader gets or creates a new CompressionReader and reset it to read from src
func (*FlatePool) GetWriter ¶
func (pool *FlatePool) GetWriter(dst io.Writer) io.WriteCloser
GetWriter gets or creates a new CompressionWriter and reset it to write to dst
func (*FlatePool) PutWriter ¶
func (pool *FlatePool) PutWriter(writer io.WriteCloser)
PutWriter places back in the pool a CompressionWriter
type GzipPool ¶
type GzipPool struct {
// contains filtered or unexported fields
}
GzipPool is a gnu zip compression pool
func (*GzipPool) GetReader ¶
GetReader gets or creates a new CompressionReader and reset it to read from src
func (*GzipPool) GetWriter ¶
func (pool *GzipPool) GetWriter(dst io.Writer) io.WriteCloser
GetWriter gets or creates a new CompressionWriter and reset it to write to dst
func (*GzipPool) PutWriter ¶
func (pool *GzipPool) PutWriter(writer io.WriteCloser)
PutWriter places back in the pool a CompressionWriter
type LZ4Pool ¶
type LZ4Pool struct {
// contains filtered or unexported fields
}
func (*LZ4Pool) GetReader ¶
GetReader gets or creates a new CompressionReader and reset it to read from src
func (*LZ4Pool) GetWriter ¶
func (pool *LZ4Pool) GetWriter(dst io.Writer) io.WriteCloser
GetWriter gets or creates a new CompressionWriter and reset it to write to dst
func (*LZ4Pool) PutWriter ¶
func (pool *LZ4Pool) PutWriter(writer io.WriteCloser)
PutWriter places back in the pool a CompressionWriter
type NoopPool ¶
type NoopPool struct{}
func (*NoopPool) GetReader ¶
GetReader gets or creates a new CompressionReader and reset it to read from src
func (*NoopPool) GetWriter ¶
func (pool *NoopPool) GetWriter(dst io.Writer) io.WriteCloser
GetWriter gets or creates a new CompressionWriter and reset it to write to dst
func (*NoopPool) PutWriter ¶
func (pool *NoopPool) PutWriter(_ io.WriteCloser)
PutWriter places back in the pool a CompressionWriter
type ReaderPool ¶
ReaderPool is a pool of io.Reader ReaderPool similar to WriterPool but for reading chunks.
func GetReaderPool ¶
func GetReaderPool(enc Codec) ReaderPool
type ReaderWriterPool ¶
type ReaderWriterPool interface { ReaderPool WriterPool }
ReaderPool is a pool of io.Reader and io.Writer
func GetPool ¶
func GetPool(enc Codec) ReaderWriterPool
type SnappyPool ¶
type SnappyPool struct {
// contains filtered or unexported fields
}
func (*SnappyPool) GetReader ¶
GetReader gets or creates a new CompressionReader and reset it to read from src
func (*SnappyPool) GetWriter ¶
func (pool *SnappyPool) GetWriter(dst io.Writer) io.WriteCloser
GetWriter gets or creates a new CompressionWriter and reset it to write to dst
func (*SnappyPool) PutReader ¶
func (pool *SnappyPool) PutReader(reader io.Reader)
PutReader places back in the pool a CompressionReader
func (*SnappyPool) PutWriter ¶
func (pool *SnappyPool) PutWriter(writer io.WriteCloser)
PutWriter places back in the pool a CompressionWriter
type WriterPool ¶
type WriterPool interface { GetWriter(io.Writer) io.WriteCloser PutWriter(io.WriteCloser) }
WriterPool is a pool of io.Writer This is used by every chunk to avoid unnecessary allocations.
func GetWriterPool ¶
func GetWriterPool(enc Codec) WriterPool
type ZstdPool ¶
type ZstdPool struct {
// contains filtered or unexported fields
}
GzipPool is a gun zip compression pool
func (*ZstdPool) GetReader ¶
GetReader gets or creates a new CompressionReader and reset it to read from src
func (*ZstdPool) GetWriter ¶
func (pool *ZstdPool) GetWriter(dst io.Writer) io.WriteCloser
GetWriter gets or creates a new CompressionWriter and reset it to write to dst
func (*ZstdPool) PutWriter ¶
func (pool *ZstdPool) PutWriter(writer io.WriteCloser)
PutWriter places back in the pool a CompressionWriter