Skip to main content

Module postings

Module postings 

Source
Expand description

Postings lists and label lookups (index v1, v2 and v3).

The index stores, for every (label name, label value) pair, a sorted list of series references, plus one extra entry for the empty key that lists every series. Which list a pair owns is recorded in the postings offset table:

postings table @ toc.postings_table
  be32 content_len
  content:
    be32 entry_count
    entry*:  uvarint 2 | uvarint name | uvarint value | uvarint offset
  be32 crc32c(content)

postings list @ entry.offset
  be32 body_len
  body:    be32 count | count * be32 series ref
  be32 crc32c(body)

Reading the whole table would cost one allocation per distinct label value, which is exactly the memory the crate promises not to spend. Instead the table is sampled the way Prometheus samples it — entry 0, then every 32nd entry of each label name, plus the last one — and a lookup walks forward from the preceding sample. The sampled table is built on first use and cached behind the same RefCell that holds the symbol cache, so IndexReader stays Send but not Sync.

Structs§

MergedPostings
The union of several postings lists, sorted and deduplicated.
PostingsList
A single postings list.
PostingsStats
Statistics from IndexReader::validate_postings.
VecPostings
An in-memory postings list: sorted references held in a Vec.

Traits§

Postings
A sorted, lazily decoded sequence of series references.