encoding

package
v2.0.0-...-fe22e9a Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBytes

func DecodeBytes(bz []byte) ([]byte, int, error)

decodeBytes decodes a varint length-prefixed byte slice, returning it along with the number of input bytes read. Assumes bz will not be mutated.

func DecodeUvarint

func DecodeUvarint(bz []byte) (uint64, int, error)

decodeUvarint decodes a varint-encoded unsigned integer from a byte slice, returning it and the number of bytes decoded.

func DecodeVarint

func DecodeVarint(bz []byte) (int64, int, error)

decodeVarint decodes a varint-encoded integer from a byte slice, returning it and the number of bytes decoded.

func EncodeBytes

func EncodeBytes(w io.Writer, bz []byte) error

EncodeBytes writes a varint length-prefixed byte slice to the writer.

func EncodeBytesSize

func EncodeBytesSize(bz []byte) int

encodeBytesSize returns the byte size of the given slice including length-prefixing.

func EncodeBytesSlice

func EncodeBytesSlice(bz []byte) ([]byte, error)

encodeBytesSlice length-prefixes the byte slice and returns it.

func EncodeUvarint

func EncodeUvarint(w io.Writer, u uint64) error

EncodeUvarint writes a varint-encoded unsigned integer to an io.Writer.

func EncodeUvarintSize

func EncodeUvarintSize(u uint64) int

EncodeUvarintSize returns the byte size of the given integer as a varint.

func EncodeVarint

func EncodeVarint(w io.Writer, i int64) error

EncodeVarint writes a varint-encoded integer to an io.Writer.

func EncodeVarintSize

func EncodeVarintSize(i int64) int

EncodeVarintSize returns the byte size of the given integer as a varint.

func MarshalChangeset

func MarshalChangeset(cs *corestore.Changeset) ([]byte, error)

MarshalChangeset returns the encoded byte representation of Changeset. NOTE: The Changeset is encoded as follows: - number of store keys (uvarint) - for each store key: -- store key (bytes) -- number of pairs (uvarint) -- for each pair: --- key (bytes) --- remove (1 byte) --- value (bytes)

func UnmarshalChangeset

func UnmarshalChangeset(cs *corestore.Changeset, buf []byte) error

UnmarshalChangeset decodes the Changeset from the given byte slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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