sharding

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ShardLabel is a reserved label referencing a shard on read path.
	ShardLabel = "__query_shard__"
	// CompactorShardIDLabel is the external label used to store
	// the ID of a sharded block generated by the split-and-merge compactor. If a block hasn't
	// this label, it means the block hasn't been split.
	CompactorShardIDLabel = "__compactor_shard_id__"
)

Variables

This section is empty.

Functions

func FormatShardIDLabelValue

func FormatShardIDLabelValue(shardID, shardCount uint64) string

FormatShardIDLabelValue expects 0-based shardID, but uses 1-based shard in the output string.

func ParseShardIDLabelValue

func ParseShardIDLabelValue(val string) (index, shardCount uint64, _ error)

ParseShardIDLabelValue returns original (0-based) shard index and shard count parsed from formatted value.

Types

type ShardSelector

type ShardSelector struct {
	ShardIndex uint64
	ShardCount uint64
}

ShardSelector holds information about the configured query shard.

func RemoveShardFromMatchers

func RemoveShardFromMatchers(matchers []*labels.Matcher) (shard *ShardSelector, filtered []*labels.Matcher, err error)

RemoveShardFromMatchers returns the input matchers without the label matcher on the query shard (if any).

func ShardFromMatchers

func ShardFromMatchers(matchers []*labels.Matcher) (shard *ShardSelector, idx int, err error)

ShardFromMatchers extracts a ShardSelector and the index it was pulled from the matcher list.

func (ShardSelector) Label

func (shard ShardSelector) Label() labels.Label

Label generates the ShardSelector as a label.

func (ShardSelector) LabelValue

func (shard ShardSelector) LabelValue() string

LabelValue returns the label value to use to select this shard.

func (ShardSelector) Matcher

func (shard ShardSelector) Matcher() *labels.Matcher

Matcher converts ShardSelector to Matcher.

Jump to

Keyboard shortcuts

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