lz4

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Copyright (C) 2019-2022 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.

Copyright (C) 2019-2022 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header = lz4.Header

Header is type alias of lz4.Header.

type LZ4

type LZ4 interface {
	NewWriterLevel(w io.Writer, level int) Writer
	NewWriter(w io.Writer) Writer
	NewReader(r io.Reader) Reader
}

LZ4 is an interface to create Writer and Reader implementation.

func New

func New() LZ4

New returns LZ4 implementation.

type MockLZ4

type MockLZ4 struct {
	NewWriterFunc      func(w io.Writer) Writer
	NewWriterLevelFunc func(w io.Writer, level int) Writer
	NewReaderFunc      func(r io.Reader) Reader
}

MockLZ4 represents mock struct of LZ4.

func (*MockLZ4) NewReader

func (m *MockLZ4) NewReader(r io.Reader) Reader

NewReader calls NewReader.

func (*MockLZ4) NewWriter

func (m *MockLZ4) NewWriter(w io.Writer) Writer

NewWriter calls NewWriterFunc.

func (*MockLZ4) NewWriterLevel

func (m *MockLZ4) NewWriterLevel(w io.Writer, level int) Writer

NewWriterLevel calls NewWriterLevelFunc.

type MockReader

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

MockReader represents mock struct of Reader.

func (*MockReader) Read

func (m *MockReader) Read(p []byte) (n int, err error)

Read calls ReadFunc.

type MockWriter

type MockWriter struct {
	WriteFunc  func(p []byte) (n int, err error)
	CloseFunc  func() error
	HeaderFunc func() *Header
	FlushFunc  func() error
}

MockWriter represents mock struct of Writer.

func (*MockWriter) Close

func (m *MockWriter) Close() error

Close calls CloseFunc.

func (*MockWriter) Flush

func (m *MockWriter) Flush() error

Flush calls FlushFunc.

func (*MockWriter) Header

func (m *MockWriter) Header() *Header

Header calls HeaderFunc.

func (*MockWriter) Write

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

Write calls WriteFunc.

type Reader

type Reader interface {
	io.Reader
}

Reader represents an interface for Reader of lz4.

type Writer

type Writer interface {
	io.WriteCloser
	Header() *Header
	Flush() error
}

Writer represents an interface for Writer of lz4.

Jump to

Keyboard shortcuts

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