pub struct GovernanceEngine { /* private fields */ }Implementations§
Source§impl GovernanceEngine
impl GovernanceEngine
Sourcepub fn global() -> &'static Self
pub fn global() -> &'static Self
The process-wide engine, built on first use from the active profile’s
<services>/governance/config.yaml.
The path is resolved here rather than through an init() seam because
a OnceLock seeded before the profile bootstrap completed would pin
the built-in defaults permanently, silently dropping every operator
policy. Resolving lazily means the first caller — whenever that is —
sees the configured chain. A profile that cannot be read falls back to
GovernanceConfig::defaults, matching GovernanceConfig::load.
Sourcepub fn from_config(config: &GovernanceConfig) -> Self
pub fn from_config(config: &GovernanceConfig) -> Self
Instantiate the chain from config against the inventory registry.
Configured ids with no registered factory are logged and skipped.
Registered policies absent from the config are appended enabled: false, so the audit trace shows them as skipped rather than omitting
them.
Sourcepub fn policies(
&self,
) -> impl Iterator<Item = (&PolicyConfig, &dyn GovernancePolicy)>
pub fn policies( &self, ) -> impl Iterator<Item = (&PolicyConfig, &dyn GovernancePolicy)>
The instantiated chain in evaluation order, for dashboards and UI projections.
Sourcepub fn evaluate(&self, ctx: &PolicyContext<'_>) -> Evaluation
pub fn evaluate(&self, ctx: &PolicyContext<'_>) -> Evaluation
Run the chain first-deny-wins, tracing every entry.
Entries switched off by config record a
ChainEntryResult::Disabled and entries after the first deny a
ChainEntryResult::Skip, both with zero duration; an empty or
all-pass chain allows with MatchedBy::DefaultIncluded.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GovernanceEngine
impl !UnwindSafe for GovernanceEngine
impl Freeze for GovernanceEngine
impl Send for GovernanceEngine
impl Sync for GovernanceEngine
impl Unpin for GovernanceEngine
impl UnsafeUnpin for GovernanceEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more