khive_runtime/runtime/serving_policy.rs
1//! Per-runtime serving policies fixed before the runtime serves: ADR-118's fresh-tail
2//! policy and the outbound email recipient policy.
3
4use super::KhiveRuntime;
5
6impl KhiveRuntime {
7 /// Return the immutable ADR-118 fresh-tail serving policy captured when
8 /// this runtime was constructed.
9 pub fn ann_fresh_tail_enabled(&self) -> bool {
10 self.ann_fresh_tail_enabled
11 }
12
13 /// Install before registering or cloning serving handles; no request-time mutation.
14 pub fn with_outbound_email_policy(mut self, policy: crate::OutboundEmailPolicy) -> Self {
15 self.outbound_email_policy = policy;
16 self
17 }
18
19 pub fn outbound_email_policy(&self) -> &crate::OutboundEmailPolicy {
20 &self.outbound_email_policy
21 }
22
23 /// Override ADR-118's fresh-tail serving policy for this runtime instance.
24 ///
25 /// This is primarily useful for embedded runtimes and deterministic tests:
26 /// it avoids mutating process-global environment state. Clones and `core()`
27 /// handles preserve the chosen value.
28 pub fn with_ann_fresh_tail_enabled(mut self, enabled: bool) -> Self {
29 self.ann_fresh_tail_enabled = enabled;
30 self
31 }
32}