pub struct LastGoodPolicies {
good: Mutex<HashMap<String, Good>>,
}Expand description
The operator source’s last-good-revision state. Empty and legitimate at startup – nothing has compiled yet, which is the “never compiled” state every id starts in, not an error.
Held by whoever repeatedly rebuilds the tree from a fresh view of the
operator’s records, the same way that view itself is held – long-lived,
across many
crate::merge::build calls, never reconstructed per rebuild, or there
would be nothing to fall back to.
Fields§
§good: Mutex<HashMap<String, Good>>Implementations§
Source§impl LastGoodPolicies
impl LastGoodPolicies
Sourcepub(crate) fn get(&self, id: &str) -> Option<(Revision, ParsedPolicy)>
pub(crate) fn get(&self, id: &str) -> Option<(Revision, ParsedPolicy)>
The last successfully-compiled ParsedPolicy for id, and the
revision it was observed at, if this id has ever compiled.
Sourcepub(crate) fn record_success(&self, id: &str, policy: &ParsedPolicy)
pub(crate) fn record_success(&self, id: &str, policy: &ParsedPolicy)
Record that policy (at id) compiled successfully at its own
revision – the new last-good, replacing whatever was stored before.
Sourcepub(crate) fn prune(&self, current: &HashMap<String, ParsedPolicy>)
pub(crate) fn prune(&self, current: &HashMap<String, ParsedPolicy>)
Drop every id not present in current – a record the current view
no longer holds at all (deleted, or
never re-observed after a source outage recovered onto a view that
no longer names it) has nothing left to fall back to, and keeping
it here would let a stale policy affect a future id that happens to
reuse the same at-uri. Called once per rebuild, after every id in
current has had a chance to update its own entry via
record_success.
Trait Implementations§
Source§impl Default for LastGoodPolicies
impl Default for LastGoodPolicies
Source§fn default() -> LastGoodPolicies
fn default() -> LastGoodPolicies
Auto Trait Implementations§
impl !Freeze for LastGoodPolicies
impl RefUnwindSafe for LastGoodPolicies
impl Send for LastGoodPolicies
impl Sync for LastGoodPolicies
impl Unpin for LastGoodPolicies
impl UnsafeUnpin for LastGoodPolicies
impl UnwindSafe for LastGoodPolicies
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<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