encoding

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BlockFloat64 designates a block encodes float64 values.
	BlockFloat64 = byte(influx.Field_Type_Float)

	// BlockInteger designates a block encodes int64 values.
	BlockInteger = byte(influx.Field_Type_Int)

	// BlockBoolean designates a block encodes boolean values.
	BlockBoolean = byte(influx.Field_Type_Boolean)

	// BlockString designates a block encodes string values.
	BlockString = byte(influx.Field_Type_String)

	// BlockTag designates a block encodes tag values.
	BlockTag = byte(influx.Field_Type_Tag)

	BlockOneBegin   = 16
	BlockFloat64One = 17
	BlockIntegerOne = 18
	BlockBooleanOne = 19
	BlockStringOne  = 20
	BlockOneEnd     = 21

	BlockFullBegin   = 30
	BlockFloat64Full = 31
	BlockIntegerFull = 32
	BlockBooleanFull = 33
	BlockStringFull  = 34
	BlockFullEnd     = 35

	BlockEmptyBegin   = 40
	BlockFloat64Empty = 41
	BlockIntegerEmpty = 42
	BlockBooleanEmpty = 43
	BlockStringEmpty  = 44
	BlockEmptyEnd     = 45
)
View Source
const (
	StringEncodingV1  uint32 = math.MaxUint32
	StringEncodingV2         = math.MaxUint32 - 1
	StringEncodingEnd        = math.MaxUint32 - 2
)
View Source
const (
	StringCompressedZstd = 2
	StringCompressedLz4  = 3
)

Variables

This section is empty.

Functions

func DecodeBooleanBlock

func DecodeBooleanBlock(in []byte, out *[]byte, ctx *CoderContext) ([]bool, error)

func DecodeFloatBlock

func DecodeFloatBlock(in []byte, out *[]byte, ctx *CoderContext) ([]float64, error)

func DecodeIntegerBlock

func DecodeIntegerBlock(in []byte, out *[]byte, ctx *CoderContext) ([]int64, error)

func DecodeStringBlock

func DecodeStringBlock(in []byte, out *[]byte, dstOffset *[]uint32, ctx *CoderContext) ([]byte, []uint32, error)

func DecodeTimestampBlock

func DecodeTimestampBlock(in []byte, out *[]byte, ctx *CoderContext) ([]int64, error)

func DecodeUnsignedBlock

func DecodeUnsignedBlock(in []byte, out *[]byte, ctx *CoderContext) ([]uint64, error)

func EncodeBooleanBlock

func EncodeBooleanBlock(in, out []byte, ctx *CoderContext) ([]byte, error)

func EncodeFloatBlock

func EncodeFloatBlock(in []byte, out []byte, ctx *CoderContext) ([]byte, error)

func EncodeIntegerBlock

func EncodeIntegerBlock(in, out []byte, ctx *CoderContext) ([]byte, error)

func EncodeStringBlock

func EncodeStringBlock(in []byte, offset []uint32, out []byte, ctx *CoderContext) ([]byte, error)

func EncodeTimestampBlock

func EncodeTimestampBlock(in, out []byte, ctx *CoderContext) ([]byte, error)

func EncodeUnsignedBlock

func EncodeUnsignedBlock(in, out []byte, ctx *CoderContext) ([]byte, error)

func IsBlockEmpty added in v1.2.0

func IsBlockEmpty(typ uint8) bool

func IsBlockFull added in v1.2.0

func IsBlockFull(typ uint8) bool

func IsBlockOne added in v1.2.0

func IsBlockOne(typ uint8) bool

func PutDataCoder

func PutDataCoder(coder DataCoder)

func RewriteTypeToEmpty added in v1.2.0

func RewriteTypeToEmpty(typ uint8) uint8

func RewriteTypeToFull added in v1.2.0

func RewriteTypeToFull(typ uint8) uint8

func ZSTDCompressBound

func ZSTDCompressBound(srcSize int) int

func ZigZagDecode

func ZigZagDecode(v uint64) int64

func ZigZagEncode

func ZigZagEncode(v int64) uint64

ZigZagEncode ZigZag encoding maps signed integers to unsigned integers from: https://developers.google.com/protocol-buffers/docs/encoding

Types

type Boolean

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

func GetBoolCoder

func GetBoolCoder() *Boolean

func (*Boolean) Decoding

func (enc *Boolean) Decoding(in []byte, out []byte) ([]byte, error)

func (*Boolean) Encoding

func (enc *Boolean) Encoding(in []byte, out []byte) ([]byte, error)

func (*Boolean) SetEncodingType

func (enc *Boolean) SetEncodingType(ty int)

type BytesBuffer

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

func NewBytesBuffer

func NewBytesBuffer(buf []byte) *BytesBuffer

func (*BytesBuffer) Bytes

func (w *BytesBuffer) Bytes() []byte

func (*BytesBuffer) Len

func (w *BytesBuffer) Len() int

func (*BytesBuffer) Read

func (w *BytesBuffer) Read(p []byte) (n int, err error)

func (*BytesBuffer) ReadByte

func (w *BytesBuffer) ReadByte() (b byte, err error)

func (*BytesBuffer) Reset

func (w *BytesBuffer) Reset(b []byte)

func (*BytesBuffer) Write

func (w *BytesBuffer) Write(p []byte) (n int, err error)

func (*BytesBuffer) WriteByte

func (w *BytesBuffer) WriteByte(b byte) error

type CoderContext

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

func NewCoderContext

func NewCoderContext() *CoderContext

func (*CoderContext) GetBoolCoder

func (ctx *CoderContext) GetBoolCoder() *Boolean

func (*CoderContext) GetFloatCoder

func (ctx *CoderContext) GetFloatCoder() *Float

func (*CoderContext) GetIntCoder

func (ctx *CoderContext) GetIntCoder() *Integer

func (*CoderContext) GetStringCoder

func (ctx *CoderContext) GetStringCoder() *String

func (*CoderContext) GetTimeCoder

func (ctx *CoderContext) GetTimeCoder() *Time

func (*CoderContext) Release

func (ctx *CoderContext) Release()

func (*CoderContext) SetBoolCoder

func (ctx *CoderContext) SetBoolCoder(boolCoder *Boolean)

func (*CoderContext) SetFloatCoder

func (ctx *CoderContext) SetFloatCoder(floatCoder *Float)

func (*CoderContext) SetIntCoder

func (ctx *CoderContext) SetIntCoder(intCoder *Integer)

func (*CoderContext) SetStringCoder

func (ctx *CoderContext) SetStringCoder(stringCoder *String)

func (*CoderContext) SetTimeCoder

func (ctx *CoderContext) SetTimeCoder(timeCoder *Time)

type DataCoder

type DataCoder interface {
	SetEncodingType(ty int)
	Encoding(in []byte, out []byte) ([]byte, error)
	Decoding(in []byte, out []byte) ([]byte, error)
}

type Float

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

func GetFloatCoder

func GetFloatCoder() *Float

func NewFloat

func NewFloat() *Float

func (*Float) Decoding

func (enc *Float) Decoding(in []byte, out []byte) ([]byte, error)

func (*Float) Encoding

func (enc *Float) Encoding(in []byte, out []byte) ([]byte, error)

func (*Float) SetEncodingType

func (enc *Float) SetEncodingType(ty int)

type Integer

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

func GetIntCoder

func GetIntCoder() *Integer

func (*Integer) Decoding

func (enc *Integer) Decoding(in []byte, out []byte) ([]byte, error)

func (*Integer) Encoding

func (enc *Integer) Encoding(in []byte, out []byte) ([]byte, error)

func (*Integer) SetEncodingType

func (enc *Integer) SetEncodingType(ty int)

type String

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

func GetStringCoder

func GetStringCoder() *String

func (*String) Decoding

func (enc *String) Decoding(in []byte, out []byte) ([]byte, error)

func (*String) Encoding

func (enc *String) Encoding(in []byte, out []byte) ([]byte, error)

func (*String) MaxEncodedLen

func (enc *String) MaxEncodedLen(size int) int

func (*String) SetEncodingType

func (enc *String) SetEncodingType(ty int)

type Time

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

func GetTimeCoder

func GetTimeCoder() *Time

func (*Time) Decoding

func (enc *Time) Decoding(in []byte, out []byte) ([]byte, error)

func (*Time) Encoding

func (enc *Time) Encoding(in []byte, out []byte) ([]byte, error)

func (*Time) SetEncodingType

func (enc *Time) SetEncodingType(ty int)

Jump to

Keyboard shortcuts

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