Documentation ¶
Overview ¶
Package compress provides compressor interface
Package compress provides compress functions ¶
Package compress provides compress functions ¶
Package compress provides compress functions ¶
Package compress provides compress functions ¶
Package compress provides compress functions ¶
Package compress provides compress functions ¶
Copyright (C) 2019-2023 vdaas.org vald team <vald@vdaas.org>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package compress provides compress functions ¶
Package compress provides compress functions
Index ¶
- type Compressor
- type GobOption
- type GzipOption
- type LZ4Option
- type MockCompressor
- func (m *MockCompressor) CompressVector(vector []float32) (bytes []byte, err error)
- func (m *MockCompressor) DecompressVector(bytes []byte) (vector []float32, err error)
- func (m *MockCompressor) Reader(src io.ReadCloser) (io.ReadCloser, error)
- func (m *MockCompressor) Writer(dst io.WriteCloser) (io.WriteCloser, error)
- type MockReadCloser
- type MockWriteCloser
- type ZstdOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compressor ¶
type Compressor interface { CompressVector(vector []float32) (bytes []byte, err error) DecompressVector(bytes []byte) (vector []float32, err error) Reader(src io.ReadCloser) (io.ReadCloser, error) Writer(dst io.WriteCloser) (io.WriteCloser, error) }
func NewGob ¶
func NewGob(opts ...GobOption) (Compressor, error)
NewGob returns a Compressor implemented using gob.
func NewGzip ¶
func NewGzip(opts ...GzipOption) (Compressor, error)
NewGzip returns Compressor implementation.
func NewLZ4 ¶
func NewLZ4(opts ...LZ4Option) (Compressor, error)
NewLZ4 returns Compressor implementation.
func NewZstd ¶
func NewZstd(opts ...ZstdOption) (Compressor, error)
NewZstd returns the zstd compressor object or any initialization error.
type GzipOption ¶
type GzipOption func(c *gzipCompressor) error
GzipOption represents the functional option for gzipCompressor.
func WithGzipCompressionLevel ¶
func WithGzipCompressionLevel(level int) GzipOption
WithGzipCompressionLevel represents the option to set the compress level for gzip.
func WithGzipGob ¶
func WithGzipGob(opts ...GobOption) GzipOption
WithGzipGob represents the option to set the GobOption to initialize Gob.
type LZ4Option ¶
type LZ4Option func(c *lz4Compressor) error
LZ4Option represents the functional option for lz4Compressor.
func WithLZ4CompressionLevel ¶
WithLZ4CompressionLevel returns the option to set compressionLevel for lz4Compressor.
func WithLZ4Gob ¶
WithLZ4Gob returns the option to set gobc for lz4Compressor.
type MockCompressor ¶ added in v0.0.51
type MockCompressor struct { CompressVectorFunc func(vector []float32) (bytes []byte, err error) DecompressVectorFunc func(bytes []byte) (vector []float32, err error) ReaderFunc func(src io.ReadCloser) (io.ReadCloser, error) WriterFunc func(dst io.WriteCloser) (io.WriteCloser, error) }
MockCompressor represents mock of Compressor.
func (*MockCompressor) CompressVector ¶ added in v0.0.51
func (m *MockCompressor) CompressVector(vector []float32) (bytes []byte, err error)
CompressVector calls CompressVectorFunc.
func (*MockCompressor) DecompressVector ¶ added in v0.0.51
func (m *MockCompressor) DecompressVector(bytes []byte) (vector []float32, err error)
DecompressVector calls DecompressVectorFunc.
func (*MockCompressor) Reader ¶ added in v0.0.51
func (m *MockCompressor) Reader(src io.ReadCloser) (io.ReadCloser, error)
Reader calls ReaderFunc.
func (*MockCompressor) Writer ¶ added in v0.0.51
func (m *MockCompressor) Writer(dst io.WriteCloser) (io.WriteCloser, error)
Writer calls WriterFunc.
type MockReadCloser ¶ added in v0.0.51
MockReadCloser represents mock of ReadCloser.
func (*MockReadCloser) Close ¶ added in v0.0.51
func (m *MockReadCloser) Close() error
Close calls CloseFunc.
type MockWriteCloser ¶ added in v0.0.51
MockWriteCloser represents mock of WriteCloser.
func (*MockWriteCloser) Close ¶ added in v0.0.51
func (m *MockWriteCloser) Close() error
Close calls CloseFunc.
type ZstdOption ¶
type ZstdOption func(c *zstdCompressor) error
ZstdOption represents the functional option for zstdCompressor.
func WithZstdCompressionLevel ¶
func WithZstdCompressionLevel(level int) ZstdOption
WithZstdCompressionLevel represents the option to set the compress level for zstd.
func WithZstdGob ¶
func WithZstdGob(opts ...GobOption) ZstdOption
WithZstdGob represents the option to set the GobOption to initialize Gob.