dio

package
v0.0.0-...-a582c34 Latest Latest
Warning

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

Go to latest
Published: May 16, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressSnappyBlock

func CompressSnappyBlock(src []byte, dst []byte) int

CompressSnappyBlock compresses the src block using snappy and store the compressed block into dst. The length of the compressed block is returned.

func DecompressSnappyBlock

func DecompressSnappyBlock(src []byte, dst []byte) error

DecompressSnappyBlock decompresses the snappy compressed data in src to the dst slice. The dst slice must be of the exact length of the uncompressed data.

func MaxBlockLen

func MaxBlockLen(ct CompressionType) uint64

MaxBlockLen returns the maximum length allowed for specified compression type.

func MaxEncodedLen

func MaxEncodedLen(ct CompressionType, srcLen uint64) (uint64, bool)

MaxEncodedLen returns the maximum length of the encoded block given the specified compression type and src length.

func NewCompressor

func NewCompressor(ct CompressionType, wc io.WriteCloser) io.WriteCloser

NewCompressor returns a Compressor instance.

func NewDecompressor

func NewDecompressor(ct CompressionType, r io.ReadCloser) io.ReadCloser

NewDecompressor return a decompressor instance.

Types

type CompressionType

type CompressionType = pb.CompressionType

CompressionType is the type of the compression.

const (
	// NoCompression is the CompressionType value used to indicate not to use
	// any compression.
	NoCompression CompressionType = pb.NoCompression
	// Snappy is the CompressionType value used to indicate that google snappy
	// is used for data compression.
	Snappy CompressionType = pb.Snappy
)

type Compressor

type Compressor struct {
	// contains filtered or unexported fields
}

Compressor is a io.WriteCloser that compresses its input data to its underlying io.Writer.

func (*Compressor) Close

func (c *Compressor) Close() error

Close closes the compressor.

func (*Compressor) Write

func (c *Compressor) Write(data []byte) (int, error)

Write compresses the input data and writes to the underlying writer.

type CountedWriter

type CountedWriter struct {
	// contains filtered or unexported fields
}

CountedWriter is a io.WriteCloser wrapper that keeps the total number of bytes written to the underlying writer.

func NewCountedWriter

func NewCountedWriter(w io.WriteCloser) *CountedWriter

NewCountedWriter creates a new CountedWriter.

func (*CountedWriter) BytesWritten

func (cw *CountedWriter) BytesWritten() uint64

BytesWritten returns the total number of bytes written.

func (*CountedWriter) Close

func (cw *CountedWriter) Close() error

Close closes the underlying writer.

func (*CountedWriter) Write

func (cw *CountedWriter) Write(data []byte) (int, error)

Write writes the specified content to the underlying writer.

type Decompressor

type Decompressor struct {
	// contains filtered or unexported fields
}

Decompressor is a io.WriteCloser that decompresses data read from its underlying reader.

func (*Decompressor) Close

func (dc *Decompressor) Close() error

Close closes the decompressor.

func (*Decompressor) Read

func (dc *Decompressor) Read(data []byte) (int, error)

Read reads from the underlying reader.

Jump to

Keyboard shortcuts

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