Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidMaxSizeCompressor = errors.New("invalid gzip compressor max size")
ErrDecompressedMsgTooLarge = errors.New("decompressed msg too large")
ErrMsgTooLarge = errors.New("msg too large to be compressed")
)
Functions ¶
This section is empty.
Types ¶
type Compressor ¶
type Compressor interface {
Compress([]byte) ([]byte, error)
Decompress([]byte) ([]byte, error)
}
Compressor compresss and decompresses messages. Decompress is the inverse of Compress. Decompress(Compress(msg)) == msg.
func NewGzipCompressor ¶
func NewGzipCompressor(maxSize int64) (Compressor, error)
NewGzipCompressor returns a new gzip Compressor that compresses
func NewNoCompressor ¶
func NewNoCompressor() Compressor
NewNoCompressor returns a Compressor that does nothing
func NewZstdCompressor ¶ added in v1.10.0
func NewZstdCompressor(maxSize int64) (Compressor, error)
type Type ¶ added in v1.10.0
type Type byte
const (
TypeNone Type = iota + 1
TypeGzip
TypeZstd
)
func TypeFromString ¶ added in v1.10.0
func TypeFromString(s string) (Type, error)
func (Type) MarshalJSON ¶ added in v1.10.0
func (t Type) MarshalJSON() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.