Documentation ¶
Index ¶
- Constants
- Variables
- type PostingListOffset
- type PostingOffsetTable
- type PostingOffsetTableV1
- func (t *PostingOffsetTableV1) LabelNames() ([]string, error)
- func (t *PostingOffsetTableV1) LabelValuesOffsets(ctx context.Context, name, prefix string, filter func(string) bool) ([]PostingListOffset, error)
- func (t *PostingOffsetTableV1) NewSparsePostingOffsetTable() (table *indexheaderpb.PostingOffsetTable)
- func (t *PostingOffsetTableV1) PostingsOffset(name string, value string) (index.Range, bool, error)
- type PostingOffsetTableV2
- func (t *PostingOffsetTableV2) LabelNames() ([]string, error)
- func (t *PostingOffsetTableV2) LabelValuesOffsets(ctx context.Context, name, prefix string, filter func(string) bool) (_ []PostingListOffset, err error)
- func (t *PostingOffsetTableV2) NewSparsePostingOffsetTable() (table *indexheaderpb.PostingOffsetTable)
- func (t *PostingOffsetTableV2) PostingsOffset(name string, value string) (r index.Range, found bool, err error)
- type Symbols
- func (s *Symbols) ForEachSymbol(syms []string, f func(sym string, offset uint32) error) (err error)
- func (s *Symbols) Lookup(o uint32) (sym string, err error)
- func (s *Symbols) NewSparseSymbol() (sparse *indexheaderpb.Symbols)
- func (s *Symbols) Reader() SymbolsReader
- func (s *Symbols) ReverseLookup(sym string) (o uint32, err error)
- type SymbolsReader
- type SymbolsTableReaderV1
- type SymbolsTableReaderV2
Constants ¶
const (
// CheckContextEveryNIterations is used in some tight loops to check if the context is done.
CheckContextEveryNIterations = 1024
)
Variables ¶
var ErrSymbolNotFound = errors.New("symbol not found")
Functions ¶
This section is empty.
Types ¶
type PostingListOffset ¶
PostingListOffset contains the start and end offset of a posting list. The Start is inclusive and is the byte offset of the number_of_entries field of a posting list. The End is exclusive and is typically the byte offset of the CRC32 field. The End might be bigger than the actual posting ending, but not larger than the whole index file.
type PostingOffsetTable ¶
type PostingOffsetTable interface { // PostingsOffset returns the byte range of the postings section for the label with the given name and value. // The Start is inclusive and is the byte offset of the number_of_entries field of a posting list. // The End is exclusive and is typically the byte offset of the CRC32 field. // The End might be bigger than the actual posting ending, but not larger than the whole index file. PostingsOffset(name string, value string) (rng index.Range, found bool, err error) // LabelValuesOffsets returns all postings lists for the label named name that match filter and have the prefix provided. // The ranges of each posting list are the same as returned by PostingsOffset. // The returned label values are sorted lexicographically (which the same as sorted by posting offset). LabelValuesOffsets(ctx context.Context, name, prefix string, filter func(string) bool) ([]PostingListOffset, error) // LabelNames returns a sorted list of all label names in this table. LabelNames() ([]string, error) NewSparsePostingOffsetTable() (table *indexheaderpb.PostingOffsetTable) }
func NewPostingOffsetTable ¶
func NewPostingOffsetTable(factory *streamencoding.DecbufFactory, tableOffset int, indexVersion int, indexLastPostingListEndBound uint64, postingOffsetsInMemSampling int, doChecksum bool) (PostingOffsetTable, error)
type PostingOffsetTableV1 ¶
type PostingOffsetTableV1 struct {
// contains filtered or unexported fields
}
func (*PostingOffsetTableV1) LabelNames ¶
func (t *PostingOffsetTableV1) LabelNames() ([]string, error)
func (*PostingOffsetTableV1) LabelValuesOffsets ¶
func (t *PostingOffsetTableV1) LabelValuesOffsets(ctx context.Context, name, prefix string, filter func(string) bool) ([]PostingListOffset, error)
func (*PostingOffsetTableV1) NewSparsePostingOffsetTable ¶
func (t *PostingOffsetTableV1) NewSparsePostingOffsetTable() (table *indexheaderpb.PostingOffsetTable)
func (*PostingOffsetTableV1) PostingsOffset ¶
type PostingOffsetTableV2 ¶
type PostingOffsetTableV2 struct {
// contains filtered or unexported fields
}
func NewPostingOffsetTableFromSparseHeader ¶
func NewPostingOffsetTableFromSparseHeader(factory *streamencoding.DecbufFactory, postingsOffsetTable *indexheaderpb.PostingOffsetTable, tableOffset int, postingOffsetsInMemSampling int) (table *PostingOffsetTableV2, err error)
func (*PostingOffsetTableV2) LabelNames ¶
func (t *PostingOffsetTableV2) LabelNames() ([]string, error)
func (*PostingOffsetTableV2) LabelValuesOffsets ¶
func (t *PostingOffsetTableV2) LabelValuesOffsets(ctx context.Context, name, prefix string, filter func(string) bool) (_ []PostingListOffset, err error)
func (*PostingOffsetTableV2) NewSparsePostingOffsetTable ¶
func (t *PostingOffsetTableV2) NewSparsePostingOffsetTable() (table *indexheaderpb.PostingOffsetTable)
NewSparsePostingOffsetTable loads all postings offset table data into a sparse index-header to be persisted to disk
func (*PostingOffsetTableV2) PostingsOffset ¶
type Symbols ¶
type Symbols struct {
// contains filtered or unexported fields
}
func NewSymbols ¶
func NewSymbols(factory *streamencoding.DecbufFactory, version, offset int, doChecksum bool) (s *Symbols, err error)
NewSymbols returns a Symbols object for symbol lookups.
func NewSymbolsFromSparseHeader ¶
func NewSymbolsFromSparseHeader(factory *streamencoding.DecbufFactory, symbols *indexheaderpb.Symbols, version int, offset int) (s *Symbols, err error)
NewSymbolsFromSparseHeader reads from sparse index header and returns a Symbols object for symbol lookups.
func (*Symbols) ForEachSymbol ¶
ForEachSymbol performs a reverse lookup on each syms and passes the symbol and offset to f. For TSDB index v1, the symbol reference is the offset of the symbol in the index header file (not the TSDB index file). For TSDB index v2, the symbol reference is the sequence number of the symbol (starting at 0).
If the reference of a symbol cannot be looked up, iteration stops immediately and the error is returned. If f returns an error, iteration stops immediately and the error is returned. ForEachSymbol returns an error with cause ErrSymbolNotFound if any symbol cannot be found.
func (*Symbols) Lookup ¶
Lookup takes a symbol reference and returns the symbol string. For TSDB index v1, the reference is expected to be the offset of the symbol in the index header file (not the TSDB index file). For TSDB index v2, the reference is expected to be the sequence number of the symbol (starting at 0). If the symbol reference is beyond the last symbol in the symbols table, the return error's cause will be ErrSymbolNotFound.
func (*Symbols) NewSparseSymbol ¶
func (s *Symbols) NewSparseSymbol() (sparse *indexheaderpb.Symbols)
NewSparseSymbol loads all symbols data into an index-header sparse to be persisted to disk
func (*Symbols) Reader ¶
func (s *Symbols) Reader() SymbolsReader
type SymbolsReader ¶
type SymbolsReader interface { io.Closer // Read should return the string for the requested symbol. // Read should be called only with increasing symbols IDs; // this also means that it is not valid to call Read with the same symbol ID multiple times. Read(uint32) (string, error) }
SymbolsReader sequentially reads symbols from a TSDB block index.
type SymbolsTableReaderV1 ¶
type SymbolsTableReaderV1 struct {
// contains filtered or unexported fields
}
func (*SymbolsTableReaderV1) Close ¶
func (r *SymbolsTableReaderV1) Close() error
type SymbolsTableReaderV2 ¶
type SymbolsTableReaderV2 struct {
// contains filtered or unexported fields
}
func (*SymbolsTableReaderV2) Close ¶
func (r *SymbolsTableReaderV2) Close() error