compress

package
v0.0.57 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

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-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt )

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

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 GobOption

type GobOption func(c *gobCompressor) 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

func WithLZ4CompressionLevel(level int) LZ4Option

WithLZ4CompressionLevel returns the option to set compressionLevel for lz4Compressor.

func WithLZ4Gob

func WithLZ4Gob(opts ...GobOption) LZ4Option

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

type MockReadCloser struct {
	ReadFunc  func(p []byte) (n int, err error)
	CloseFunc func() error
}

MockReadCloser represents mock of ReadCloser.

func (*MockReadCloser) Close added in v0.0.51

func (m *MockReadCloser) Close() error

Close calls CloseFunc.

func (*MockReadCloser) Read added in v0.0.51

func (m *MockReadCloser) Read(p []byte) (int, error)

Read calls ReadFunc.

type MockWriteCloser added in v0.0.51

type MockWriteCloser struct {
	WriteFunc func(p []byte) (n int, err error)
	CloseFunc func() error
}

MockWriteCloser represents mock of WriteCloser.

func (*MockWriteCloser) Close added in v0.0.51

func (m *MockWriteCloser) Close() error

Close calls CloseFunc.

func (*MockWriteCloser) Write added in v0.0.51

func (m *MockWriteCloser) Write(p []byte) (int, error)

Write calls WriterFunc.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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