codec

package
v1.3.0-rc.1.0...-65594da Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec interface {
	Decode([]byte) (interface{}, error)
	Encode(interface{}) ([]byte, error)

	// CodecID is a short identifier to communicate what codec should be used to decode the value.
	// Once in use, this should be stable to avoid confusing other clients.
	CodecID() string
}

Codec allows KV clients to serialise and deserialise values.

type Proto

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

Proto is a Codec for proto/snappy

func NewProtoCodec

func NewProtoCodec(id string, factory func() proto.Message) Proto

func (Proto) CodecID

func (p Proto) CodecID() string

func (Proto) Decode

func (p Proto) Decode(bytes []byte) (interface{}, error)

Decode implements Codec

func (Proto) Encode

func (p Proto) Encode(msg interface{}) ([]byte, error)

Encode implements Codec

type String

type String struct{}

String is a code for strings.

func (String) CodecID

func (String) CodecID() string

func (String) Decode

func (String) Decode(bytes []byte) (interface{}, error)

Decode implements Codec.

func (String) Encode

func (String) Encode(msg interface{}) ([]byte, error)

Encode implements Codec.

Jump to

Keyboard shortcuts

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