snappy

package module
v0.0.0-...-c322873 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 4 Imported by: 134 modules, 135 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-xerial-snappy

Build Status

Xerial-compatible Snappy framing support for golang.

Packages using Xerial for snappy encoding use a framing format incompatible with basically everything else in existence. This package wraps Go's built-in snappy package to support it.

Apps that use this format include Apache Kafka (see https://github.com/dpkp/kafka-python/issues/126#issuecomment-35478921 for details).

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrMalformed is returned by the decoder when the xerial framing
	// is malformed
	ErrMalformed = errors.New("malformed xerial framing")
)

Functions

func Decode

func Decode(src []byte) ([]byte, error)

Decode decodes snappy data whether it is traditional unframed or includes the xerial framing format.

func DecodeInto

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

DecodeInto decodes snappy data whether it is traditional unframed or includes the xerial framing format into the specified `dst`. It is assumed that the entirety of `dst` including all capacity is available for use by this function. If `dst` is nil *or* insufficiently large to hold the decoded `src`, new space will be allocated.

func Encode

func Encode(src []byte) []byte

Encode encodes data as snappy with no framing header.

func EncodeStream

func EncodeStream(dst, src []byte) []byte

EncodeStream *appends* to the specified 'dst' the compressed 'src' in xerial framing format. If 'dst' does not have enough capacity, then a new slice will be allocated. If 'dst' has non-zero length, then if *must* have been built using this function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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