pub struct Generation { /* private fields */ }Expand description
One coherent snapshot of the reloadable policy surface.
A Generation bundles the Catalog, ResolvedPolicy index, and
export-resolved Config tables that together drive a Pdp decision, plus
a monotonic id that names this snapshot in the audit trail.
It is the unit that BrokerState swaps atomically on reload: an operation
that pins one Generation sees an internally consistent
(catalog, policy, config) triple for its entire lifetime, so a concurrent
reload can never mix an old catalog with a new policy.
Implementations§
Source§impl Generation
impl Generation
Sourcepub fn new(
id: u64,
catalog: impl Into<Arc<Catalog>>,
policy: ResolvedPolicy,
config: Config,
) -> Self
pub fn new( id: u64, catalog: impl Into<Arc<Catalog>>, policy: ResolvedPolicy, config: Config, ) -> Self
Bundle a (catalog, policy, config) triple under a generation id.
Sourcepub const fn id(&self) -> u64
pub const fn id(&self) -> u64
This generation’s monotonic id (for the audit record / status probe).
Sourcepub fn pdp(&self) -> Pdp<'_>
pub fn pdp(&self) -> Pdp<'_>
A Pdp borrowing this generation’s catalog/policy/config for one
decision.
The PDP is Copy and holds only shared borrows into this generation, so
this is a cheap view, not a clone. The borrow ties the PDP to the
generation snapshot, keeping the whole decision coherent.
Sourcepub const fn config(&self) -> &Config
pub const fn config(&self) -> &Config
The export-resolved config tables (for name(num) audit rendering).
Sourcepub const fn policy(&self) -> &ResolvedPolicy
pub const fn policy(&self) -> &ResolvedPolicy
This generation’s resolved authorization policy.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Generation
impl RefUnwindSafe for Generation
impl Send for Generation
impl Sync for Generation
impl Unpin for Generation
impl UnsafeUnpin for Generation
impl UnwindSafe for Generation
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
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request