Skip to main content

PolicyPoll

Struct PolicyPoll 

Source
pub struct PolicyPoll {
    operator_did: String,
    this_pds: String,
    gate: Arc<TreePolicyGate>,
    set: PolicySet,
    store: Option<PolicyStore>,
    across: AcrossBuilds,
    declared_lookups: Arc<DeclaredLookups>,
}
Expand description

The operator’s policy records as this deployment reads and enforces them, across ticks.

Fields§

§operator_did: String§this_pds: String§gate: Arc<TreePolicyGate>§set: PolicySet§store: Option<PolicyStore>

Where the installed set is kept so a restart comes back with it. None for a run with no data directory, which has nowhere durable to put one.

§across: AcrossBuilds

Held here, not per tick, so a policy whose new revision will not compile has the revision that did to fall back to.

§declared_lookups: Arc<DeclaredLookups>

The lookups of the set in force, swapped beside the tree so the write path reads what the policies it will be judged by declare. Shared with the router; see crate::DeclaredLookups.

Implementations§

Source§

impl PolicyPoll

Source

pub fn new( operator_did: impl Into<String>, this_pds: impl Into<String>, gate: Arc<TreePolicyGate>, store: Option<PolicyStore>, declared_lookups: Arc<DeclaredLookups>, ) -> Self

A poll of operator_did’s repository on behalf of the server whose service DID is this_pds, swapping each set it builds into gate and keeping it in store. declared_lookups is the router’s, so the set that judges a write and the records read for it are the same set.

Source

pub fn restore( &self, registry: &dyn Registry, ) -> Result<Option<Arc<PolicyRevision>>, RestoreError>

Puts the kept set back in force, before any tick has run.

Answers the revision restored, or None for a deployment that has never installed one.

§Errors

RestoreError for a kept set this binary cannot read or cannot build whole. Both stop the boot: a server that comes online without denials it had in force is the one outcome this must not produce.

Source

pub fn rejected(&self) -> Option<Arc<RejectedBuild>>

What the newest observation refused, if it refused anything.

Source

pub fn enforced_set(&self) -> Option<Arc<EnforcedSet>>

What the gate enforces, as an operator reads it back.

Source

pub async fn poll_once( &self, client: &Client, endpoint: &str, registry: &dyn Registry, ) -> Result<Arc<PolicyRevision>, PolicyPollError>

One tick against the operator’s repository at endpoint: list both collections, build the set, and swap it in. registry answers the admission tree a binding’s subjects are checked against.

Source

fn build( &self, observed: &Observed, registry: &dyn Registry, in_force: &PolicyRevision, ) -> Result<BoundTree, EmptiedSet>

Builds observed against in_force, with this server’s identity and the registry’s admission tree.

Source

fn summarise( &self, revision: &PolicyRevision, registry: &dyn Registry, refused: Vec<BuildFailure>, carried: Vec<BuildFailure>, ) -> EnforcedSet

The set as an operator reads it back, with each binding’s reach resolved against the accounts this server holds right now.

One pass over the accounts per installed set, which is why it is built here — on the poll’s tick — and handed to the gate, rather than computed on each bot.did.stats call.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,