Documentation
¶
Overview ¶
Package series is the series-identity index: it maps a content-addressed signal.SeriesID to its full identity (signal.Series — Resource + Scope + data-point attributes) and back. Adding a series is idempotent (the id is the hash of the identity), so the same series ingested twice — or replayed from the WAL — resolves to one entry. The stored identity lets a query reconstruct a series' labels from an id.
Index ¶
- type Entry
- type Index
- func (ix *Index) Add(s signal.Series) signal.SeriesID
- func (ix *Index) ForEach(fn func(id signal.SeriesID, s signal.Series))
- func (ix *Index) Get(id signal.SeriesID) (signal.Series, bool)
- func (ix *Index) Has(id signal.SeriesID) bool
- func (ix *Index) Len() int
- func (ix *Index) SizeBytes() int64
- func (ix *Index) Snapshot() []Entry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶ added in v0.37.0
Entry is one registered identity: its content-addressed id and the identity itself.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index maps signal.SeriesID → signal.Series. The zero value is not usable; create one with New. Not safe for concurrent use; callers own synchronization.
func (*Index) Add ¶
Add interns a series identity and returns its signal.SeriesID. It is idempotent: re-adding an equal identity returns the same id without storing a second copy. The identity's byte payloads are interned (not cloned) and its resource/scope sets are deduplicated, so the caller may reuse its buffers and each distinct string — and each distinct resource/scope — is stored once across the whole index.
func (*Index) SizeBytes ¶ added in v0.37.0
SizeBytes returns the index's resident footprint: the interned symbol table, the id→identity entries, the deduplicated resource/scope sets, and the reusable scratch buffers. It is the index's share of the engine's identity state, which no sample/record byte counter sees.
func (*Index) Snapshot ¶ added in v0.37.0
Snapshot returns the identities registered so far, in registration order. The result stays valid and immutable **without the caller's lock**: entries are only ever appended, so a later Index.Add either writes past the returned slice's end or moves to a new array, and never touches what this one refers to. A caller rebuilding the index off-lock snapshots here, and picks up whatever was registered meanwhile as the tail past its length. It must not mutate the entries.