pub struct Analyzer { /* private fields */ }Expand description
A stateful observer of a conversation it is not part of.
Feed it every frame, in order, with the role that sent it. It keeps one Registry
from both sides, tracks the active control type, and validates each message with the
full cross-message Context — so S2-FRBC-003,
S2-STATE-001, S2-INST-001 and S2-PEBC-006 fire here and nowhere else outside a
live session.
Decoding is lenient by default: an analyzer that refuses a message carrying a
vendor extension hides the peer’s real bug behind its own strictness.
Analyzer::strict is the other choice.
Implementations§
Source§impl Analyzer
impl Analyzer
Sourcepub const fn profile(self, profile: WireProfile) -> Self
pub const fn profile(self, profile: WireProfile) -> Self
Decode against a particular wire profile.
A transcript of a 0.0.2-beta session must be read as one, or every
DDBC.SystemDescription in it is a profile mismatch.
Sourcepub const fn strict(self) -> Self
pub const fn strict(self) -> Self
Refuse a message with a property the schema does not define, as an endpoint would.
Sourcepub const fn over_s2_connect(self) -> Self
pub const fn over_s2_connect(self) -> Self
Read the conversation as one carried by S2 Connect, where a handshake is redundant.
Sourcepub const fn skew_tolerance(self, tolerance: Duration) -> Self
pub const fn skew_tolerance(self, tolerance: Duration) -> Self
How far a peer’s clock may differ before it is worth reporting.
Sourcepub const fn registry(&self) -> &Registry
pub const fn registry(&self) -> &Registry
Everything the conversation has published, from both sides.
Sourcepub const fn active_control_type(&self) -> Option<ControlType>
pub const fn active_control_type(&self) -> Option<ControlType>
The control type in force, as the conversation has selected it.
Sourcepub fn observe(
&mut self,
sender: EnergyManagementRole,
text: &str,
now: Timestamp,
) -> Observed
pub fn observe( &mut self, sender: EnergyManagementRole, text: &str, now: Timestamp, ) -> Observed
Observe one frame.
Total: a frame that is not JSON, not S2 or not in the profile yields a report
carrying S2-MSG-004, not an error — an analyzer that stops at the first bad frame
stops exactly where it was needed.