zstd

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: 2 Imported by: 0

Documentation

Overview

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.

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.

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DOption added in v0.0.56

type DOption = zstd.DOption

DOption is type alias of zstd.DOption.

type Decoder

type Decoder interface {
	io.Reader
	Close()
	WriteTo(w io.Writer) (int64, error)
}

Decoder represents an interface for Decoder of zstd.

type EOption

type EOption = zstd.EOption

EOption is type alias of zstd.EOption.

func WithEncoderLevel

func WithEncoderLevel(level int) EOption

WithEncoderLevel calls zstd.WithEncoderLevel.

type Encoder

type Encoder interface {
	io.WriteCloser
	ReadFrom(r io.Reader) (n int64, err error)
}

Encoder represents an interface for Encoder of zstd.

type MockDecoder

type MockDecoder struct {
	CloseFunc   func()
	ReadFunc    func(p []byte) (int, error)
	WriteToFunc func(w io.Writer) (int64, error)
}

MockDecoder represents

func (*MockDecoder) Close

func (m *MockDecoder) Close()

Close calls CloseFunc.

func (*MockDecoder) Read

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

Read calls ReadFunc.

func (*MockDecoder) WriteTo

func (m *MockDecoder) WriteTo(w io.Writer) (int64, error)

WriteTo calls WriteToFunc.

type MockEncoder

type MockEncoder struct {
	WriteFunc    func(p []byte) (n int, err error)
	CloseFunc    func() error
	ReadFromFunc func(r io.Reader) (n int64, err error)
}

MockEncoder represents mock of Encoder.

func (*MockEncoder) Close

func (m *MockEncoder) Close() error

Close calls CloseFunc.

func (*MockEncoder) ReadFrom

func (m *MockEncoder) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom calls ReadFromFunc.

func (*MockEncoder) Write

func (m *MockEncoder) Write(p []byte) (n int, err error)

Write calls WriteFunc.

type MockZstd

type MockZstd struct {
	NewWriterFunc func(w io.Writer, opts ...zstd.EOption) (Encoder, error)
	NewReaderFunc func(r io.Reader, opts ...zstd.DOption) (Decoder, error)
}

MockZstd represents mock struct of Zstd.

func (*MockZstd) NewReader

func (m *MockZstd) NewReader(r io.Reader, opts ...zstd.DOption) (Decoder, error)

NewReader calls NewReader.

func (*MockZstd) NewWriter

func (m *MockZstd) NewWriter(w io.Writer, opts ...zstd.EOption) (Encoder, error)

NewWriter calls NewWriterFunc.

type Zstd

type Zstd interface {
	NewWriter(w io.Writer, opts ...EOption) (Encoder, error)
	NewReader(r io.Reader, opts ...DOption) (Decoder, error)
}

Zstd is an interface to create Writer and Reader implementation.

func New

func New() Zstd

New returns Zstd implementation.

Jump to

Keyboard shortcuts

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