1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//! Layer 3: the derived index.
//!
//! The log is the source of truth; this is derived from it and rebuildable by replay.
//! The in-memory core:
//!
//! - [`ActiveTail`]: a per-segment index, per-tag postings plus a dense type column, fed
//! in position order and shared lock-free for reading via a watermark-bounded
//! [`ActiveView`]. Tag and type interning use concurrent maps.
//! - [`search`]: the index-driven query evaluator, the counterpart to the scan
//! oracle (`writer::condition`). It answers a [`Query`](crate::query::Query)
//! identically to a scan, which the differential test pins down.
//!
//! The on-disk half: an `IndexSegment` format (CRC-locked header, FST term dictionary,
//! tiered postings, dense type column), an `IndexSet` that owns the sealed segments plus
//! the active tail and answers a [`Query`](crate::query::Query) across all of them, inline
//! feeding at the commit seam, seal-on-rollover, and rebuild-from-log recovery. [`search`]
//! is generic over [`SegmentIndex`] so the one spec-pinned evaluator serves both the
//! in-memory tail (through [`ActiveView`]) and the on-disk `IndexSegment` unchanged.
use Cow;
use cratePosition;
pub use ;
pub use ;
pub use search;
pub use ;
pub use ;
pub use ;
/// A segment-local identifier for a tag, dense from 0.
///
/// Interned per [`ActiveTail`] (Lucene-style), so ids never need to be stable across
/// segments and there is no global registry to persist.
;
/// A segment-local identifier for an event type, dense from 0.
///
/// A `u16` because event types are low cardinality (10s to 100s), so the dense type
/// column addresses them directly at two bytes each.
;
/// One segment's worth of index that [`search`] can evaluate a query against, whether
/// it lives in memory (an [`ActiveView`] over the [`ActiveTail`]) or on disk
/// ([`IndexSegment`]).
///
/// The two share exactly one evaluator. Both return
/// [`term_postings`](SegmentIndex::term_postings) as an owned [`Cow::Owned`]: the on-disk
/// segment decodes varint deltas, the active view materializes its chunked, watermark-
/// truncated postings. Positions are segment-local (`global - base`).