Documentation ¶
Overview ¶
originally from https://github.com/cortexproject/cortex/blob/868898a2921c662dcd4f90683e8b95c927a8edd8/pkg/ingester/index/index.go but modified to support sharding queries.
Index ¶
- Constants
- Variables
- type InvertedIndex
- func (ii *InvertedIndex) Add(labels []logproto.LabelAdapter, fp model.Fingerprint) labels.Labels
- func (ii *InvertedIndex) Delete(labels labels.Labels, fp model.Fingerprint)
- func (ii *InvertedIndex) LabelNames(shard *astmapper.ShardAnnotation) ([]string, error)
- func (ii *InvertedIndex) LabelValues(name string, shard *astmapper.ShardAnnotation) ([]string, error)
- func (ii *InvertedIndex) Lookup(matchers []*labels.Matcher, shard *astmapper.ShardAnnotation) ([]model.Fingerprint, error)
Constants ¶
View Source
const DefaultIndexShards = 32
Variables ¶
View Source
var ErrInvalidShardQuery = errors.New("incompatible index shard query")
Functions ¶
This section is empty.
Types ¶
type InvertedIndex ¶
type InvertedIndex struct {
// contains filtered or unexported fields
}
InvertedIndex implements a in-memory inverted index from label pairs to fingerprints. It is sharded to reduce lock contention on writes.
func NewWithShards ¶
func NewWithShards(totalShards uint32) *InvertedIndex
func (*InvertedIndex) Add ¶
func (ii *InvertedIndex) Add(labels []logproto.LabelAdapter, fp model.Fingerprint) labels.Labels
Add a fingerprint under the specified labels. NOTE: memory for `labels` is unsafe; anything retained beyond the life of this function must be copied
func (*InvertedIndex) Delete ¶
func (ii *InvertedIndex) Delete(labels labels.Labels, fp model.Fingerprint)
Delete a fingerprint with the given label pairs.
func (*InvertedIndex) LabelNames ¶
func (ii *InvertedIndex) LabelNames(shard *astmapper.ShardAnnotation) ([]string, error)
LabelNames returns all label names.
func (*InvertedIndex) LabelValues ¶
func (ii *InvertedIndex) LabelValues(name string, shard *astmapper.ShardAnnotation) ([]string, error)
LabelValues returns the values for the given label.
func (*InvertedIndex) Lookup ¶
func (ii *InvertedIndex) Lookup(matchers []*labels.Matcher, shard *astmapper.ShardAnnotation) ([]model.Fingerprint, error)
Lookup all fingerprints for the provided matchers.
Click to show internal directories.
Click to hide internal directories.