tagkeymeta

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MergerName kv.MergerType = "TagKeyMetaMerger"

Functions

func NewMerger

func NewMerger(kvFlusher kv.Flusher) (kv.Merger, error)

NewMerger creates a merger for compacting tag-key-meta

Types

type Flusher

type Flusher interface {
	// EnsureSize ensures slice's capacity to meets the demand
	EnsureSize(size int)
	// FlushTagValue ends writing trie tree in tag index table.
	FlushTagValue(tagValue []byte, tagValueID uint32)
	// FlushTagKeyID ends writing trie tree data in tag index table.
	FlushTagKeyID(tagKeyID uint32, tagValueSeq uint32) error

	// Closer closes the writer, this will be called after writing all tagKeys.
	io.Closer
	// contains filtered or unexported methods
}

Flusher is a wrapper of kv.Builder, provides the ability to build a tag index table. The layout is available in `tsdb/doc.go`

func NewFlusher

func NewFlusher(kvFlusher kv.Flusher) (Flusher, error)

NewFlusher returns a new TagFlusher

type Reader

type Reader interface {
	// GetTagValueSeq returns the auto sequence of tag value under the tag key,
	// if not exist return constants.ErrTagValueSeqNotFound
	GetTagValueSeq(tagKeyID tag.KeyID) (tagValueSeq uint32, err error)

	// GetTagValueID returns the tag value id for spec tag key id of metric,
	// if not exist return constants.ErrTagValueIDNotFound
	GetTagValueID(tagKeyID tag.KeyID, tagValue string) (tagValueID uint32, err error)

	// GetTagValueIDsForTagKeyID get tag value ids for spec tag key id of metric
	GetTagValueIDsForTagKeyID(tagKeyID tag.KeyID) (tagValueIDs *roaring.Bitmap, err error)

	// FindValueIDsByExprForTagKeyID finds tag values ids by tag filter expr and tag key id
	FindValueIDsByExprForTagKeyID(tagKeyID tag.KeyID, expr stmt.TagFilter) (tagValueIDs *roaring.Bitmap, err error)

	// SuggestTagValues finds tag values by prefix search
	SuggestTagValues(tagKeyID tag.KeyID, tagValuePrefix string, limit int) []string

	// WalkTagValues walks each tag value and tag value id via fn.
	// If fn returns false, the iteration is stopped.
	// The values are the raw byte slices and not the converted types.
	WalkTagValues(
		tagKeyID tag.KeyID,
		tagValuePrefix string,
		fn func(tagValue []byte, tagValueID uint32) bool,
	) error

	// CollectTagValues collects the tag values by tag value ids,
	CollectTagValues(tagKeyID tag.KeyID, tagValueIDs *roaring.Bitmap, tagValues map[uint32]string) error
}

Reader reads tag value data from tag-index-table

func NewReader

func NewReader(readers []table.Reader) Reader

NewReader returns a new TagReader

type TagKeyMeta

type TagKeyMeta interface {
	// TagValueIDSeq returns the auto sequence of tag value id under this tag key
	TagValueIDSeq() uint32
	// TagValueIDs returns all tag value ids under this tag key
	TagValueIDs() (*roaring.Bitmap, error)
	// CollectTagValues collects the tag values by tag value ids,
	CollectTagValues(tagValueIDs *roaring.Bitmap, tagValues map[uint32]string) error
	// TrieTree returns the trie tree
	TrieTree() (trie.SuccinctTrie, error)
	// PrefixIterator returns a iterator for prefix iterating the Iterator
	PrefixIterator(tagValuePrefix []byte) (*trie.PrefixIterator, error)
	// FindTagValueID finds tagValueIDs by tagValue
	FindTagValueID(tagValue string) (tagValueIDs []uint32)
	// FindTagValueIDs finds tagValueIDs in tagValue
	FindTagValueIDs(tagValues []string) (tagValueIDs []uint32)
	// FindTagValueIDsByLike finds tagValueIDs like tagValue,
	// 3 cases: *sdb, ts*, *sd*
	FindTagValueIDsByLike(tagValue string) (tagValueIDs []uint32)
	// FindTagValueIDsByRegex finds tagValueIDs by regex pattern,
	FindTagValueIDsByRegex(tagValuePattern string) (tagValueIDs []uint32)
}

type TagKeyMetas

type TagKeyMetas []TagKeyMeta

func (TagKeyMetas) GetTagValueIDs

func (metas TagKeyMetas) GetTagValueIDs() (*roaring.Bitmap, error)

GetTagValueIDs gets all tag value ids under tag-keys meta

Jump to

Keyboard shortcuts

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