encoding

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MarshalTypeZSTDNearestDelta2 is used for marshaling counter
	// timeseries.
	MarshalTypeZSTDNearestDelta2 = MarshalType(1)

	// MarshalTypeDeltaConst is used for marshaling constantly changed
	// time series with constant delta.
	MarshalTypeDeltaConst = MarshalType(2)

	// MarshalTypeConst is used for marshaling time series containing only
	// a single constant.
	MarshalTypeConst = MarshalType(3)

	// MarshalTypeZSTDNearestDelta is used for marshaling gauge timeseries.
	MarshalTypeZSTDNearestDelta = MarshalType(4)

	// MarshalTypeNearestDelta2 is used instead of MarshalTypeZSTDNearestDelta2
	// if compression doesn't help.
	MarshalTypeNearestDelta2 = MarshalType(5)

	// MarshalTypeNearestDelta is used instead of MarshalTypeZSTDNearestDelta
	// if compression doesn't help.
	MarshalTypeNearestDelta = MarshalType(6)
)

Variables

This section is empty.

Functions

func CheckMarshalType

func CheckMarshalType(mt MarshalType) error

CheckMarshalType verifies whether the mt is valid.

func CheckPrecisionBits

func CheckPrecisionBits(precisionBits uint8) error

CheckPrecisionBits makes sure precisionBits is in the range [1..64].

func CompressZSTDLevel

func CompressZSTDLevel(dst, src []byte, compressLevel int) []byte

CompressZSTDLevel appends compressed src to dst and returns the appended dst.

The given compressLevel is used for the compression.

func DecompressZSTD

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

DecompressZSTD decompresses src, appends the result to dst and returns the appended dst.

func EnsureNonDecreasingSequence

func EnsureNonDecreasingSequence(a []int64, vMin, vMax int64)

EnsureNonDecreasingSequence makes sure the first item in a is vMin, the last item in a is vMax and all the items in a are non-decreasing.

If this isn't the case then a is fixed accordingly.

func MarshalBool

func MarshalBool(dst []byte, v bool) []byte

MarshalBool appends marshaled v to dst and returns the result.

func MarshalBytes

func MarshalBytes(dst, b []byte) []byte

MarshalBytes appends marshaled b to dst and returns the result.

func MarshalInt16

func MarshalInt16(dst []byte, v int16) []byte

MarshalInt16 appends marshaled v to dst and returns the result.

func MarshalInt64

func MarshalInt64(dst []byte, v int64) []byte

MarshalInt64 appends marshaled v to dst and returns the result.

func MarshalUint16

func MarshalUint16(dst []byte, u uint16) []byte

MarshalUint16 appends marshaled v to dst and returns the result.

func MarshalUint32

func MarshalUint32(dst []byte, u uint32) []byte

MarshalUint32 appends marshaled v to dst and returns the result.

func MarshalUint64

func MarshalUint64(dst []byte, u uint64) []byte

MarshalUint64 appends marshaled v to dst and returns the result.

func MarshalVarInt64

func MarshalVarInt64(dst []byte, v int64) []byte

MarshalVarInt64 appends marshalsed v to dst and returns the result.

func MarshalVarInt64s

func MarshalVarInt64s(dst []byte, vs []int64) []byte

MarshalVarInt64s appends marshaled vs to dst and returns the result.

func MarshalVarUint64

func MarshalVarUint64(dst []byte, u uint64) []byte

MarshalVarUint64 appends marshaled u to dst and returns the result.

func MarshalVarUint64s

func MarshalVarUint64s(dst []byte, us []uint64) []byte

MarshalVarUint64s appends marshaled us to dst and returns the result.

func PutInt64s

func PutInt64s(is *Int64s)

PutInt64s returns is to the pool.

func PutUint32s

func PutUint32s(is *Uint32s)

PutUint32s returns is to the pool.

func PutUint64s

func PutUint64s(is *Uint64s)

PutUint64s returns is to the pool.

func UnmarshalBool

func UnmarshalBool(src []byte) bool

UnmarshalBool unmarshals bool from src.

func UnmarshalBytes

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

UnmarshalBytes returns unmarshaled bytes from src.

func UnmarshalInt16

func UnmarshalInt16(src []byte) int16

UnmarshalInt16 returns unmarshaled int16 from src.

func UnmarshalInt64

func UnmarshalInt64(src []byte) int64

UnmarshalInt64 returns unmarshaled int64 from src.

func UnmarshalTimestamps

func UnmarshalTimestamps(dst []int64, src []byte, mt MarshalType, firstTimestamp int64, itemsCount int) ([]int64, error)

UnmarshalTimestamps unmarshals timestamps from src, appends them to dst and returns the resulting dst.

firstTimestamp must be the timestamp returned from MarshalTimestamps.

func UnmarshalUint16

func UnmarshalUint16(src []byte) uint16

UnmarshalUint16 returns unmarshaled uint16 from src.

func UnmarshalUint32

func UnmarshalUint32(src []byte) uint32

UnmarshalUint32 returns unmarshaled uint32 from src.

func UnmarshalUint64

func UnmarshalUint64(src []byte) uint64

UnmarshalUint64 returns unmarshaled uint64 from src.

func UnmarshalValues

func UnmarshalValues(dst []int64, src []byte, mt MarshalType, firstValue int64, itemsCount int) ([]int64, error)

UnmarshalValues unmarshals values from src, appends them to dst and returns the resulting dst.

firstValue must be the value returned from MarshalValues.

func UnmarshalVarInt64

func UnmarshalVarInt64(src []byte) ([]byte, int64, error)

UnmarshalVarInt64 returns unmarshaled int64 from src and returns the remaining tail from src.

func UnmarshalVarInt64s

func UnmarshalVarInt64s(dst []int64, src []byte) ([]byte, error)

UnmarshalVarInt64s unmarshals len(dst) int64 values from src to dst and returns the remaining tail from src.

func UnmarshalVarUint64

func UnmarshalVarUint64(src []byte) ([]byte, uint64, error)

UnmarshalVarUint64 returns unmarshaled uint64 from src and returns the remaining tail from src.

func UnmarshalVarUint64s

func UnmarshalVarUint64s(dst []uint64, src []byte) ([]byte, error)

UnmarshalVarUint64s unmarshals len(dst) uint64 values from src to dst and returns the remaining tail from src.

Types

type Int64s

type Int64s struct {
	A []int64
}

Int64s holds an int64 slice

func GetInt64s

func GetInt64s(size int) *Int64s

GetInt64s returns an int64 slice with the given size. The slice contents isn't initialized - it may contain garbage.

type MarshalType

type MarshalType byte

MarshalType is the type used for the marshaling.

func MarshalTimestamps

func MarshalTimestamps(dst []byte, timestamps []int64, precisionBits uint8) (result []byte, mt MarshalType, firstTimestamp int64)

MarshalTimestamps marshals timestamps, appends the marshaled result to dst and returns the dst.

timestamps must contain non-decreasing values.

precisionBits must be in the range [1...64], where 1 means 50% precision, while 64 means 100% precision, i.e. lossless encoding.

func MarshalValues

func MarshalValues(dst []byte, values []int64, precisionBits uint8) (result []byte, mt MarshalType, firstValue int64)

MarshalValues marshals values, appends the marshaled result to dst and returns the dst.

precisionBits must be in the range [1...64], where 1 means 50% precision, while 64 means 100% precision, i.e. lossless encoding.

func (MarshalType) NeedsValidation

func (mt MarshalType) NeedsValidation() bool

NeedsValidation returns true if mt may need additional validation for silent data corruption.

type Uint32s

type Uint32s struct {
	A []uint32
}

Uint32s holds an uint32 slice

func GetUint32s

func GetUint32s(size int) *Uint32s

GetUint32s returns an uint32 slice with the given size. The slize contents isn't initialized - it may contain garbage.

type Uint64s

type Uint64s struct {
	A []uint64
}

Uint64s holds an uint64 slice

func GetUint64s

func GetUint64s(size int) *Uint64s

GetUint64s returns an uint64 slice with the given size. The slice contents isn't initialized - it may contain garbage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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