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: AcrossBuildsHeld 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
impl PolicyPoll
Sourcepub fn new(
operator_did: impl Into<String>,
this_pds: impl Into<String>,
gate: Arc<TreePolicyGate>,
store: Option<PolicyStore>,
declared_lookups: Arc<DeclaredLookups>,
) -> Self
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.
Sourcepub fn restore(
&self,
registry: &dyn Registry,
) -> Result<Option<Arc<PolicyRevision>>, RestoreError>
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.
Sourcepub fn rejected(&self) -> Option<Arc<RejectedBuild>>
pub fn rejected(&self) -> Option<Arc<RejectedBuild>>
What the newest observation refused, if it refused anything.
Sourcepub fn enforced_set(&self) -> Option<Arc<EnforcedSet>>
pub fn enforced_set(&self) -> Option<Arc<EnforcedSet>>
What the gate enforces, as an operator reads it back.
Sourcepub async fn poll_once(
&self,
client: &Client,
endpoint: &str,
registry: &dyn Registry,
) -> Result<Arc<PolicyRevision>, PolicyPollError>
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.
Sourcefn build(
&self,
observed: &Observed,
registry: &dyn Registry,
in_force: &PolicyRevision,
) -> Result<BoundTree, EmptiedSet>
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.
Sourcefn summarise(
&self,
revision: &PolicyRevision,
registry: &dyn Registry,
refused: Vec<BuildFailure>,
carried: Vec<BuildFailure>,
) -> EnforcedSet
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§
impl !Freeze for PolicyPoll
impl !RefUnwindSafe for PolicyPoll
impl Send for PolicyPoll
impl Sync for PolicyPoll
impl Unpin for PolicyPoll
impl UnsafeUnpin for PolicyPoll
impl !UnwindSafe for PolicyPoll
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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