tag

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const EmptyTagKeyID = KeyID(0)

EmptyTagKeyID represents empty value for tag key id.

Variables

This section is empty.

Functions

func ConcatKeyValues

func ConcatKeyValues(kvs KeyValues) string

func ConcatTagValues

func ConcatTagValues(tagValues []string) string

ConcatTagValues concat the tag values to string

func EscapeTag

func EscapeTag(in []byte) []byte

func SplitTagValues

func SplitTagValues(tags string) []string

SplitTagValues splits the string of tag values to array

func UnescapeTag

func UnescapeTag(in []byte) []byte

func XXHashOfKeyValues

func XXHashOfKeyValues(kvs KeyValues) uint64

XXHashOfKeyValues calculates a hash of sorted KeyValues If length <= 256, allocates a slice on stack. Otherwise, picks a buffer from sync pool to hold the concated string.

Types

type KeyID

type KeyID uint32

KeyID represents tag key id type.

type KeyValues

type KeyValues []*protoMetricsV1.KeyValue

func KeyValuesFromMap

func KeyValuesFromMap(tags map[string]string) KeyValues

func (KeyValues) Clone

func (kvs KeyValues) Clone() KeyValues

Clone returns a copy of keyValues

func (KeyValues) DeDup

func (kvs KeyValues) DeDup() KeyValues

DeDup sorts keyvalues and removes the duplicates

func (KeyValues) Len

func (kvs KeyValues) Len() int

func (KeyValues) Less

func (kvs KeyValues) Less(i, j int) bool

func (KeyValues) Map

func (kvs KeyValues) Map() map[string]string

Map transforms the KeyValues into map

func (KeyValues) Merge

func (kvs KeyValues) Merge(other KeyValues) KeyValues

Merge merges another keyvalue list into a new one

func (KeyValues) Swap

func (kvs KeyValues) Swap(i, j int)

type Meta

type Meta struct {
	Key string
	ID  KeyID
}

Meta holds the relation of tagKey and its ID

func (*Meta) MarshalBinary

func (m *Meta) MarshalBinary() (data []byte, err error)

type Metas

type Metas []Meta

Metas implements sort.Interface, it's sorted by name

func UnmarshalBinary

func UnmarshalBinary(data []byte) (Metas, error)

func (Metas) Find

func (fms Metas) Find(tagKey string) (Meta, bool)

func (Metas) Len

func (fms Metas) Len() int

func (Metas) Less

func (fms Metas) Less(i, j int) bool

func (Metas) Swap

func (fms Metas) Swap(i, j int)

type Tag

type Tag struct {
	Key   []byte
	Value []byte
}

Tag represents a kv tag pair.

func NewTag

func NewTag(key, value []byte) Tag

NewTag returns a new Tag

func (Tag) Size

func (t Tag) Size() int

Size returns the slice's size of the key and value.

type Tags

type Tags []Tag

Tags implements sort.Interface

func TagsFromMap

func TagsFromMap(m map[string]string) Tags

func (Tags) AppendHashKey

func (tags Tags) AppendHashKey(dst []byte) []byte

AppendHashKey appends the result of hashing all of a tag's keys and values to dst and returns the extended buffer.

func (Tags) Clone

func (tags Tags) Clone() Tags

func (Tags) Len

func (tags Tags) Len() int

func (Tags) Less

func (tags Tags) Less(i, j int) bool

func (Tags) Map

func (tags Tags) Map() map[string]string

func (Tags) Size

func (tags Tags) Size() int

func (Tags) String

func (tags Tags) String() string

func (Tags) Swap

func (tags Tags) Swap(i, j int)

Jump to

Keyboard shortcuts

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