Skip to main content

zenkey_fleet/
model.rs

1//! **Layer 2 — the model.** What the observations *mean*, without asking the
2//! bus anything.
3//!
4//! One rule places a module here: *it can do its job from values already in
5//! hand*. Nothing below takes a session. A key becomes a described key
6//! ([`facts`]), a set of served slices becomes a queryable registry
7//! ([`registry`]) and a set of rows ([`project`]), a stream of samples
8//! becomes rates and latencies ([`stats`]) or a tree ([`tree`], [`skeleton`]),
9//! two payloads become a diff ([`diff`]), a payload plus a schema becomes a
10//! rendering ([`decode`]).
11//!
12//! Being session-free is the useful property, not an accident of history: it
13//! is what lets a frontend replay a `.zrec` through the same projections it
14//! runs live, and what lets these modules be unit-tested without a bus. A
15//! function here that finds it needs a session belongs in [`crate::bus`],
16//! with this layer projecting what it brought back.
17//!
18//! The layer also owns the two mechanisms every long-running projection
19//! shares: [`bounded`] (the O6 ceiling and its eviction ledger) and
20//! [`retain`] (the retention budget). A model that grows without a bound is
21//! not a model of a fleet, it is a leak.
22//!
23//! Nothing here judges. `stats` reports a latency that contains clock skew
24//! and says so; it does not call the transport slow. Verdicts are
25//! [`crate::judge`]'s.
26
27pub mod bounded;
28pub mod diff;
29pub mod examples;
30pub mod facts;
31pub mod jsonschema;
32pub mod project;
33pub mod registry;
34pub mod retain;
35pub mod skeleton;
36pub mod stats;
37pub mod tree;
38
39#[cfg(feature = "decode")]
40pub mod decode;