codec

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetaInfoSize = keySize + valueSize + checksumSize
)

Variables

This section is empty.

Functions

func DecodeEntry

func DecodeEntry(b []byte, e *internal.Entry, maxKeySize uint32, maxValueSize uint64) error

DecodeEntry decodes a serialized entry

func IsCorruptedData

func IsCorruptedData(err error) bool

IsCorruptedData indicates if the error correspondes to possible data corruption

Types

type Decoder

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

Decoder wraps an underlying io.Reader and allows you to stream Entry decodings on it.

func NewDecoder

func NewDecoder(r io.Reader, maxKeySize uint32, maxValueSize uint64) *Decoder

NewDecoder creates a streaming Entry decoder.

func (*Decoder) Decode

func (d *Decoder) Decode(v *internal.Entry) (int64, error)

Decode decodes the next Entry from the current stream

type Encoder

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

Encoder wraps an underlying io.Writer and allows you to stream Entry encodings on it.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder creates a streaming Entry encoder.

func (*Encoder) Encode

func (e *Encoder) Encode(msg internal.Entry) (int64, error)

Encode takes any Entry and streams it to the underlying writer. Messages are framed with a key-length and value-length prefix.

Jump to

Keyboard shortcuts

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