Skip to main content

ProtectedHeaderJournal

Struct ProtectedHeaderJournal 

Source
pub struct ProtectedHeaderJournal { /* private fields */ }
Expand description

The in-memory protected headers of every cluster, and the unresolved proposals that may still replace them.

A proposal is effective at once. A rejection drops it, so the newest remaining proposal, else the confirmed state, is effective: an ancestor’s rejection leaves a live descendant alone. An acceptance confirms the proposal and supersedes every older one, which can no longer change the outcome. Resolved proposals are forgotten; versions are never reused, so a late or repeated resolution finds nothing and changes nothing.

There is no serde, no Clone and Debug prints counts only: the journal never reaches a state file, a task snapshot or a log.

Implementations§

Source§

impl ProtectedHeaderJournal

Source

pub fn propose( &mut self, cluster: &str, change: ProtectedHeaderChange, ) -> Result<ProtectedHeaderVersion, VersionExhausted>

Record change as the effective state of cluster until it is resolved. Nothing is touched when the versions are exhausted.

Source

pub fn holds_values(&self) -> bool

Whether the journal retains a non-empty header set anywhere: confirmed, or in any unresolved proposal, for any cluster. A later Clear or Remove hides the headers beneath it without dropping them, so this looks at every retained state and not only Self::effective.

Source

pub fn confirmed_bootstrap<'m>( &self, metadata: impl Fn(&str) -> Option<&'m [HealthCheckHeader]>, ) -> Result<Option<ConfirmedBootstrap>, TransferError>

What a fresh worker must be given to hold the confirmed values: the clusters whose confirmed set is not empty, in lexical order, and the version they are all staged under. None when no value is held.

Read-only: it proposes, accepts and rejects nothing, and returns no byte of a value. A fresh worker store is empty, so the last version the journal issued is acceptable for every cluster: it is at least 1 as soon as a value was ever held, and no cluster was confirmed under a newer one. Refused while any proposal is unresolved, and when a confirmed set is not the one metadata names.

Source

pub fn effective(&self, cluster: &str) -> Option<&ProtectedHeaderSet>

The effective protected headers of cluster: None when it is absent, an empty set when it was cleared.

Source

pub fn proposed( &self, cluster: &str, version: ProtectedHeaderVersion, ) -> Option<Option<&ProtectedHeaderSet>>

The state version proposed for cluster while it is unresolved: None when the version is unknown or resolved, Some(None) for a removal.

Source

pub fn accept( &mut self, cluster: &str, version: ProtectedHeaderVersion, ) -> Resolution

Every targeted worker acknowledged version. It becomes the confirmed state and supersedes the proposals older than it.

Source

pub fn reject( &mut self, cluster: &str, version: ProtectedHeaderVersion, ) -> Resolution

version failed: drop it and fall back to what is left.

Trait Implementations§

Source§

impl Debug for ProtectedHeaderJournal

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProtectedHeaderJournal

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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

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

Source§

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

Source§

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

Source§

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.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.