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
//! Phase-discriminant encoding shared between the SSE event loop and the
//! wall-clock ticker.
//!
//! Why: the ticker must read the current phase without locking `ReindexUi`.
//! Encoding the `ReindexPhase` as a small integer in an `AtomicU64` lets the
//! single-writer event loop publish the phase and the ticker read it back to
//! produce a footer label that always matches the header.
//! What: `phase_to_u64` maps a phase to its discriminant; `u64_to_label` maps
//! the discriminant back to its display label.
//! Test: round-trip covered indirectly by `tests::eta_logic_loading_model_and_zero_denom`.
use crateReindexPhase;
/// Encode a [`ReindexPhase`] as a stable discriminant for the ticker atomic.
///
/// Why: lets the ticker observe the active phase without locking `ReindexUi`.
/// What: maps each phase to a fixed `u64`; `Embedding`/`ParseEmbed` collapse to
/// `4` and any other variant defaults to `4` (Embedding).
/// Test: paired with `u64_to_label` in the ticker; exercised by ETA-logic test.
///
/// Encoding: we (ab)use AtomicU64 to carry a discriminant. The mapping is:
/// 0 = Connecting, 1 = Walking, 2 = Chunking, 3 = InitializingEmbedder,
/// 4 = Embedding, 5 = KnowledgeGraph (other variants map to 4 as default)
pub
/// Decode a phase discriminant back to its display label.
///
/// Why: the ticker renders a footer label matching the header by reading the
/// shared discriminant and resolving it back to `ReindexPhase::label()`.
/// What: maps each discriminant to the corresponding phase label; unknown
/// values fall back to the `Embedding` label.
/// Test: paired with `phase_to_u64`; exercised via the ticker.
pub