Documentation
¶
Index ¶
- Constants
- func CheckMarshalType(mt MarshalType) error
- func CheckPrecisionBits(precisionBits uint8) error
- func CompressZSTDLevel(dst, src []byte, compressLevel int) []byte
- func DecompressZSTD(dst, src []byte) ([]byte, error)
- func EnsureNonDecreasingSequence(a []int64, vMin, vMax int64)
- func IsZstd(data []byte) bool
- func MarshalBool(dst []byte, v bool) []byte
- func MarshalBytes(dst, b []byte) []byte
- func MarshalInt16(dst []byte, v int16) []byte
- func MarshalInt64(dst []byte, v int64) []byte
- func MarshalUint16(dst []byte, u uint16) []byte
- func MarshalUint32(dst []byte, u uint32) []byte
- func MarshalUint64(dst []byte, u uint64) []byte
- func MarshalVarInt64(dst []byte, v int64) []byte
- func MarshalVarInt64s(dst []byte, vs []int64) []byte
- func MarshalVarUint64(dst []byte, u uint64) []byte
- func MarshalVarUint64s(dst []byte, us []uint64) []byte
- func PutFloat64s(a *Float64s)
- func PutInt64s(is *Int64s)
- func PutUint32s(is *Uint32s)
- func PutUint64s(is *Uint64s)
- func UnmarshalBool(src []byte) bool
- func UnmarshalBytes(src []byte) ([]byte, int)
- func UnmarshalInt16(src []byte) int16
- func UnmarshalInt64(src []byte) int64
- func UnmarshalTimestamps(dst []int64, src []byte, mt MarshalType, firstTimestamp int64, itemsCount int) ([]int64, error)
- func UnmarshalUint16(src []byte) uint16
- func UnmarshalUint32(src []byte) uint32
- func UnmarshalUint64(src []byte) uint64
- func UnmarshalValues(dst []int64, src []byte, mt MarshalType, firstValue int64, itemsCount int) ([]int64, error)
- func UnmarshalVarInt64(src []byte) (int64, int)
- func UnmarshalVarInt64s(dst []int64, src []byte) ([]byte, error)
- func UnmarshalVarUint64(src []byte) (uint64, int)
- func UnmarshalVarUint64s(dst []uint64, src []byte) ([]byte, error)
- type Float64s
- type Int64s
- type MarshalType
- type Uint32s
- type Uint64s
Constants ¶
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 ¶
CheckPrecisionBits makes sure precisionBits is in the range [1..64].
func CompressZSTDLevel ¶
CompressZSTDLevel appends compressed src to dst and returns the appended dst.
The given compressLevel is used for the compression.
func DecompressZSTD ¶
DecompressZSTD decompresses src, appends the result to dst and returns the appended dst.
func EnsureNonDecreasingSequence ¶
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 IsZstd ¶ added in v1.102.19
IsZstd checks if the given data is compressed using the zstd format. It does this by verifying the presence of the zstd magic number (0xFD2FB528) at the beginning of the byte slice.
See: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#zstandard-frames
func MarshalBool ¶ added in v1.92.0
MarshalBool appends marshaled v to dst and returns the result.
func MarshalBytes ¶
MarshalBytes appends marshaled b to dst and returns the result.
func MarshalInt16 ¶
MarshalInt16 appends marshaled v to dst and returns the result.
func MarshalInt64 ¶
MarshalInt64 appends marshaled v to dst and returns the result.
func MarshalUint16 ¶
MarshalUint16 appends marshaled v to dst and returns the result.
func MarshalUint32 ¶
MarshalUint32 appends marshaled v to dst and returns the result.
func MarshalUint64 ¶
MarshalUint64 appends marshaled v to dst and returns the result.
func MarshalVarInt64 ¶
MarshalVarInt64 appends marshalsed v to dst and returns the result.
func MarshalVarInt64s ¶
MarshalVarInt64s appends marshaled vs to dst and returns the result.
func MarshalVarUint64 ¶
MarshalVarUint64 appends marshaled u to dst and returns the result.
func MarshalVarUint64s ¶
MarshalVarUint64s appends marshaled us to dst and returns the result.
func PutFloat64s ¶ added in v1.97.7
func PutFloat64s(a *Float64s)
PutFloat64s returns a to the pool, so it can be reused via GetFloat64s.
The a cannot be used after returning to the pull.
func UnmarshalBool ¶ added in v1.92.0
UnmarshalBool unmarshals bool from src.
func UnmarshalBytes ¶
UnmarshalBytes returns unmarshaled bytes from src and the size of the unmarshaled bytes.
It returns 0 or negative value if it is impossible to unmarshal bytes from src.
func UnmarshalInt16 ¶
UnmarshalInt16 returns unmarshaled int16 from src.
The caller must ensure that len(src) >= 2
func UnmarshalInt64 ¶
UnmarshalInt64 returns unmarshaled int64 from src.
The caller must ensure that len(src) >= 8
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 ¶
UnmarshalUint16 returns unmarshaled uint16 from src.
the caller must ensure that len(src) >= 2
func UnmarshalUint32 ¶
UnmarshalUint32 returns unmarshaled uint32 from src.
The caller must ensure than len(src) >= 4
func UnmarshalUint64 ¶
UnmarshalUint64 returns unmarshaled uint64 from src.
The caller must ensure that len(src) >= 8
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 ¶
UnmarshalVarInt64 returns unmarshaled int64 from src and its size in bytes.
It returns 0 or negative value if it cannot unmarshal int64 from src.
func UnmarshalVarInt64s ¶
UnmarshalVarInt64s unmarshals len(dst) int64 values from src to dst and returns the remaining tail from src.
func UnmarshalVarUint64 ¶
UnmarshalVarUint64 returns unmarshaled uint64 from src and its size in bytes.
It returns 0 or negative value if it cannot unmarshal uint64 from src.
Types ¶
type Float64s ¶ added in v1.97.7
type Float64s struct {
A []float64
}
Float64s holds an array of float64 values.
func GetFloat64s ¶ added in v1.97.7
GetFloat64s returns a slice of float64 values with the given size.
When the returned slice is no longer needed, it is advised calling PutFloat64s() on it, so it could be reused.
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 ¶ added in v1.83.0
func (mt MarshalType) NeedsValidation() bool
NeedsValidation returns true if mt may need additional validation for silent data corruption.
type Uint32s ¶ added in v1.92.0
type Uint32s struct {
A []uint32
}
Uint32s holds an uint32 slice
func GetUint32s ¶ added in v1.92.0
GetUint32s returns an uint32 slice with the given size. The slize contents isn't initialized - it may contain garbage.