Documentation
¶
Index ¶
- Constants
- func AllPostingsKey() (name, value string)
- func ExpandPostings(p Postings) (res []uint64, err error)
- func NewStringTuples(entries []string, length int) (*stringTuples, error)
- type ByteSlice
- type Decoder
- type MemPostings
- func (p *MemPostings) Add(id uint64, lset labels.Labels)
- func (p *MemPostings) All() Postings
- func (p *MemPostings) Delete(deleted map[uint64]struct{})
- func (p *MemPostings) EnsureOrder()
- func (p *MemPostings) Get(name, value string) Postings
- func (p *MemPostings) Iter(f func(labels.Label, Postings) error) error
- func (p *MemPostings) SortedKeys() []labels.Label
- type Postings
- type Range
- type Reader
- func (r *Reader) Close() error
- func (r *Reader) LabelIndices() ([][]string, error)
- func (r *Reader) LabelNames() ([]string, error)
- func (r *Reader) LabelValues(names ...string) (StringTuples, error)
- func (r *Reader) Postings(name, value string) (Postings, error)
- func (r *Reader) PostingsRanges() (map[labels.Label]Range, error)
- func (r *Reader) Series(id uint64, lbls *labels.Labels, chks *[]chunks.Meta) error
- func (r *Reader) SortedPostings(p Postings) Postings
- func (r *Reader) SymbolTable() map[uint32]string
- func (r *Reader) Symbols() (map[string]struct{}, error)
- func (r *Reader) Version() int
- type StringTuples
- type Writer
- func (w *Writer) AddSeries(ref uint64, lset labels.Labels, chunks ...chunks.Meta) error
- func (w *Writer) AddSymbols(sym map[string]struct{}) error
- func (w *Writer) Close() error
- func (w *Writer) WriteLabelIndex(names []string, values []string) error
- func (w *Writer) WritePostings(name, value string, it Postings) error
Constants ¶
const (
// MagicIndex 4 bytes at the head of an index file.
MagicIndex = 0xBAAAD700
)
Variables ¶
This section is empty.
Functions ¶
func AllPostingsKey ¶
func AllPostingsKey() (name, value string)
AllPostingsKey returns the label key that is used to store the postings list of all existing IDs.
func ExpandPostings ¶
ExpandPostings returns the postings expanded as a slice.
func NewStringTuples ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder provides decoding methods for the v1 and v2 index file format.
It currently does not contain decoding methods for all entry types but can be extended by them if there's demand.
func (*Decoder) Series ¶
Series decodes a series entry from the given byte slice into lset and chks.
func (*Decoder) SetSymbolTable ¶
SetSymbolTable set the symbol table to be used for lookups when decoding series and label indices
type MemPostings ¶
type MemPostings struct {
// contains filtered or unexported fields
}
MemPostings holds postings list for series ID per label pair. They may be written to out of order. ensureOrder() must be called once before any reads are done. This allows for quick unordered batch fills on startup.
func NewMemPostings ¶
func NewMemPostings() *MemPostings
NewMemPostings returns a memPostings that's ready for reads and writes.
func NewUnorderedMemPostings ¶
func NewUnorderedMemPostings() *MemPostings
NewUnorderedMemPostings returns a memPostings that is not safe to be read from until ensureOrder was called once.
func (*MemPostings) Add ¶
func (p *MemPostings) Add(id uint64, lset labels.Labels)
Add a label set to the postings index.
func (*MemPostings) All ¶
func (p *MemPostings) All() Postings
All returns a postings list over all documents ever added.
func (*MemPostings) Delete ¶
func (p *MemPostings) Delete(deleted map[uint64]struct{})
Delete removes all ids in the given map from the postings lists.
func (*MemPostings) EnsureOrder ¶
func (p *MemPostings) EnsureOrder()
EnsureOrder ensures that all postings lists are sorted. After it returns all further calls to add and addFor will insert new IDs in a sorted manner.
func (*MemPostings) Get ¶
func (p *MemPostings) Get(name, value string) Postings
Get returns a postings list for the given label pair.
func (*MemPostings) Iter ¶
Iter calls f for each postings list. It aborts if f returns an error and returns it.
func (*MemPostings) SortedKeys ¶
func (p *MemPostings) SortedKeys() []labels.Label
SortedKeys returns a list of sorted label keys of the postings.
type Postings ¶
type Postings interface { // Next advances the iterator and returns true if another value was found. Next() bool // Seek advances the iterator to value v or greater and returns // true if a value was found. Seek(v uint64) bool // At returns the value at the current iterator position. At() uint64 // Err returns the last error of the iterator. Err() error }
Postings provides iterative access over a postings list.
func EmptyPostings ¶
func EmptyPostings() Postings
EmptyPostings returns a postings list that's always empty.
func ErrPostings ¶
ErrPostings returns new postings that immediately error.
func NewListPostings ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func NewFileReader ¶
NewFileReader returns a new index reader against the given index file.
func NewReader ¶
NewReader returns a new IndexReader on the given byte slice. It automatically handles different format versions.
func (*Reader) LabelIndices ¶
LabelIndices returns a slice of label names for which labels or label tuples value indices exist. NOTE: This is deprecated. Use `LabelNames()` instead.
func (*Reader) LabelNames ¶
LabelNames returns all the unique label names present in the index.
func (*Reader) LabelValues ¶
func (r *Reader) LabelValues(names ...string) (StringTuples, error)
LabelValues returns value tuples that exist for the given label name tuples.
func (*Reader) PostingsRanges ¶
PostingsRanges returns a new map of byte range in the underlying index file for all postings lists.
func (*Reader) Series ¶
Series reads the series with the given ID and writes its labels and chunks into lbls and chks.
func (*Reader) SortedPostings ¶
SortedPostings returns the given postings list reordered so that the backing series are sorted.
func (*Reader) SymbolTable ¶
SymbolTable returns the symbol table that is used to resolve symbol references.
type StringTuples ¶
type StringTuples interface { // Total number of tuples in the list. Len() int // At returns the tuple at position i. At(i int) ([]string, error) }
StringTuples provides access to a sorted list of string tuples.
type Writer ¶
type Writer struct { Version int // contains filtered or unexported fields }
Writer implements the IndexWriter interface for the standard serialization format.
func NewWriter ¶
NewWriter returns a new Writer to the given filename. It serializes data in format version 2.