pub struct EventLog { /* private fields */ }Implementations§
Source§impl EventLog
impl EventLog
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self, EventLogError>
pub fn open(path: impl AsRef<Path>) -> Result<Self, EventLogError>
Opens (creating if needed) the event log and applies pending migration steps in order, idempotently.
§Errors
Returns EventLogError::Storage on any SQLite failure.
Sourcepub fn begin_session(&self) -> Result<SessionId, EventLogError>
pub fn begin_session(&self) -> Result<SessionId, EventLogError>
Starts a new session (fresh UUID; seq restarts at 1 within it).
§Errors
Currently infallible in practice; Result for API stability.
Sourcepub fn append(
&self,
session: &SessionId,
result: &CheckResult,
) -> Result<GateEvent, EventLogError>
pub fn append( &self, session: &SessionId, result: &CheckResult, ) -> Result<GateEvent, EventLogError>
Appends one gate decision as an event and returns its envelope.
§Errors
Returns EventLogError on storage or serialization failure.
Sourcepub fn append_failopen(
&self,
session: &SessionId,
detail: &str,
) -> Result<GateEvent, EventLogError>
pub fn append_failopen( &self, session: &SessionId, detail: &str, ) -> Result<GateEvent, EventLogError>
Records a fail-open occurrence (review directive: visible, queryable).
§Errors
Returns EventLogError on storage failure.
Sourcepub fn append_escalation(
&self,
session: &SessionId,
detail: &str,
) -> Result<GateEvent, EventLogError>
pub fn append_escalation( &self, session: &SessionId, detail: &str, ) -> Result<GateEvent, EventLogError>
Records a ladder escalation (attempt cap reached — addendum §7/§8).
§Errors
Returns EventLogError on storage failure.
Sourcepub fn append_telemetry(
&self,
session: &SessionId,
telemetry: Telemetry<'_>,
) -> Result<GateEvent, EventLogError>
pub fn append_telemetry( &self, session: &SessionId, telemetry: Telemetry<'_>, ) -> Result<GateEvent, EventLogError>
Records a non-decision telemetry event (spec §14: delivery, nudge
arms, and compression tiers ride the same stream as gate
decisions, distinguished by decision = "telemetry").
§Errors
Returns EventLogError on storage failure.
Sourcepub fn attempts(
&self,
session: &SessionId,
rule: &str,
file: &str,
) -> Result<u64, EventLogError>
pub fn attempts( &self, session: &SessionId, rule: &str, file: &str, ) -> Result<u64, EventLogError>
Session-scoped rule-hit counter — the Phase 2 escalation-ladder substrate (attempt N derives from this).
§Errors
Returns EventLogError::Storage on query failure.
Sourcepub fn block_count(&self, session: &SessionId) -> Result<u64, EventLogError>
pub fn block_count(&self, session: &SessionId) -> Result<u64, EventLogError>
Count of block decisions in a session (any rule, any file).
§Errors
Returns EventLogError::Storage on query failure.
Sourcepub fn rule_count(
&self,
session: &SessionId,
rule: &str,
) -> Result<u64, EventLogError>
pub fn rule_count( &self, session: &SessionId, rule: &str, ) -> Result<u64, EventLogError>
Count of events in a session filed under rule (telemetry included).
§Errors
Returns EventLogError::Storage on query failure.
Sourcepub fn failopen_count(&self, session: &SessionId) -> Result<u64, EventLogError>
pub fn failopen_count(&self, session: &SessionId) -> Result<u64, EventLogError>
Sourcepub fn stats(&self) -> Result<StatsSummary, EventLogError>
pub fn stats(&self) -> Result<StatsSummary, EventLogError>
Aggregates for pushkin stats (spec §14): blocks by rule,
compression savings, nudge arms, fail-opens — across all sessions
in this repo’s log. Historical rows keep their legacy-prefixed
ids (append-only); aggregation normalizes so the mixed population
groups as one rule (remediation pass 3, PART B2).
§Errors
Returns EventLogError::Storage on query failure.
Sourcepub fn decision_counts(&self) -> Result<(u64, u64), EventLogError>
pub fn decision_counts(&self) -> Result<(u64, u64), EventLogError>
Decision counts for the compact statusline segment: (checks, denials) — real gate decisions only, escalation marker rows excluded so three denials read as three, not four.
§Errors
Returns EventLogError::Storage on query failure.
Sourcepub fn latest_session_escalated(&self) -> Result<bool, EventLogError>
pub fn latest_session_escalated(&self) -> Result<bool, EventLogError>
Whether the most recent session has hit the escalation ladder cap.
§Errors
Returns EventLogError::Storage on query failure.
Sourcepub fn mean_attempts_to_compliance(&self) -> Result<Option<f64>, EventLogError>
pub fn mean_attempts_to_compliance(&self) -> Result<Option<f64>, EventLogError>
Mean-time-to-compliance (integration doc §8): across sessions that
recovered (a block followed by an allow), the average number of
attempts — denials before the allow, plus the complying write.
None when no session has recovered yet.
§Errors
Returns EventLogError::Storage on query failure.