invertedindex

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthRemote        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRemote          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupRemote = fmt.Errorf("proto: unexpected end of group")
)

Functions

func LabelMatchersSort

func LabelMatchersSort(matchers []*prompb.LabelMatcher) []*prompb.LabelMatcher

func MetricMatches

func MetricMatches(metric StreamMetric, matchers ...*Matcher) bool

Types

type BadgerIndex

type BadgerIndex struct {
	// contains filtered or unexported fields
}

func NewBadgerIndex

func NewBadgerIndex(db *badger.DB, batcher *badgerbatcher.BadgerDBBatcher) (*BadgerIndex, error)

func OpenBadgerIndex

func OpenBadgerIndex(ctx context.Context, path string) (*BadgerIndex, error)

func (*BadgerIndex) Insert

func (index *BadgerIndex) Insert(streamMetric StreamMetric) error

key format: |$0|sep|lable_name|sep|lable_value|stream_id name sep value sep streamIO

func (*BadgerIndex) Matches

func (index *BadgerIndex) Matches(labelMatchers ...*prompb.LabelMatcher) ([]StreamMetric, error)

type DB

type DB interface {
	IndexInserter
	IndexMatcher
}

type IndexInserter

type IndexInserter interface {
	Insert(streamMetric StreamMetric) error
}

type IndexMatcher

type IndexMatcher interface {
	Matches(matcher ...*prompb.LabelMatcher) ([]StreamMetric, error)
}

type Matcher

type Matcher struct {
	// contains filtered or unexported fields
}

func NewMatcher

func NewMatcher(labelMatcher *prompb.LabelMatcher) *Matcher

func NewMatchers

func NewMatchers(labelMatchers ...*prompb.LabelMatcher) []*Matcher

func (*Matcher) Matches

func (matcher *Matcher) Matches(metric StreamMetric) bool

type StreamID

type StreamID uint64

type StreamMetric

type StreamMetric struct {
	Labels               []prompb.Label `protobuf:"bytes,1,rep,name=Labels,proto3" json:"Labels"`
	StreamID             StreamID       `protobuf:"varint,2,opt,name=StreamID,proto3,customtype=StreamID" json:"StreamID"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func MetricsMatches

func MetricsMatches(metrics []StreamMetric, matchers ...*Matcher) []StreamMetric

func (*StreamMetric) Descriptor

func (*StreamMetric) Descriptor() ([]byte, []int)

func (*StreamMetric) GetLabels

func (m *StreamMetric) GetLabels() []prompb.Label

func (*StreamMetric) Marshal

func (m *StreamMetric) Marshal() (dAtA []byte, err error)

func (*StreamMetric) MarshalTo

func (m *StreamMetric) MarshalTo(dAtA []byte) (int, error)

func (*StreamMetric) MarshalToSizedBuffer

func (m *StreamMetric) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*StreamMetric) ProtoMessage

func (*StreamMetric) ProtoMessage()

func (*StreamMetric) Reset

func (m *StreamMetric) Reset()

func (*StreamMetric) Size

func (m *StreamMetric) Size() (n int)

func (*StreamMetric) String

func (m *StreamMetric) String() string

func (*StreamMetric) ToPromString

func (sm *StreamMetric) ToPromString() string

func (*StreamMetric) Unmarshal

func (m *StreamMetric) Unmarshal(dAtA []byte) error

func (*StreamMetric) XXX_DiscardUnknown

func (m *StreamMetric) XXX_DiscardUnknown()

func (*StreamMetric) XXX_Marshal

func (m *StreamMetric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StreamMetric) XXX_Merge

func (m *StreamMetric) XXX_Merge(src proto.Message)

func (*StreamMetric) XXX_Size

func (m *StreamMetric) XXX_Size() int

func (*StreamMetric) XXX_Unmarshal

func (m *StreamMetric) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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