compressor

package
v0.0.0-...-095586d Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Compressors which supported by rpc

Functions

This section is empty.

Types

type CompressType

type CompressType uint16

CompressType type of compressions supported by rpc

const (
	Raw CompressType = iota
	Gzip
	Snappy
	Zlib
)

type Compressor

type Compressor interface {
	Zip([]byte) ([]byte, error)
	Unzip([]byte) ([]byte, error)
}

Compressor is interface, each compressor has Zip and Unzip functions

type GzipCompressor

type GzipCompressor struct {
}

Zlib 是一个广泛使用的压缩库,基于 DEFLATE 算法,具有良好的压缩比和较快的速度。 GzipCompressor implements the Compressor interface

func (GzipCompressor) Unzip

func (GzipCompressor) Unzip(data []byte) ([]byte, error)

Unzip.

func (GzipCompressor) Zip

func (GzipCompressor) Zip(data []byte) ([]byte, error)

Zip. GzipCompressor object is not used in this func so omit the receiver name

type RawCompressor

type RawCompressor struct {
}

RawCompressor implements the Compressor interface

func (RawCompressor) Unzip

func (RawCompressor) Unzip(data []byte) ([]byte, error)

Unzip .

func (RawCompressor) Zip

func (RawCompressor) Zip(data []byte) ([]byte, error)

Zip .

type SnappyCompressor

type SnappyCompressor struct {
}

Snappy 是由 Google 开发的一种压缩库,专注于高压缩速度和合理的压缩比。Snappy 并不追求最小化的压缩率,而是优先保证较高的压缩和解压速度,使其非常适合需要快速处理大量数据的场景。 SnappyCompressor implements the Compressor interface

func (SnappyCompressor) Unzip

func (SnappyCompressor) Unzip(data []byte) ([]byte, error)

Unzip .

func (SnappyCompressor) Zip

func (SnappyCompressor) Zip(data []byte) ([]byte, error)

Zip .

type ZlibCompressor

type ZlibCompressor struct {
}

ZlibCompressor implements the Compressor interface

func (ZlibCompressor) Unzip

func (ZlibCompressor) Unzip(data []byte) ([]byte, error)

Unzip .

func (ZlibCompressor) Zip

func (ZlibCompressor) Zip(data []byte) ([]byte, error)

Zip .

Jump to

Keyboard shortcuts

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