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
impl ProtectedHeaderJournal
Sourcepub fn propose(
&mut self,
cluster: &str,
change: ProtectedHeaderChange,
) -> Result<ProtectedHeaderVersion, VersionExhausted>
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.
Sourcepub fn holds_values(&self) -> bool
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.
Sourcepub fn confirmed_bootstrap<'m>(
&self,
metadata: impl Fn(&str) -> Option<&'m [HealthCheckHeader]>,
) -> Result<Option<ConfirmedBootstrap>, TransferError>
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.
Sourcepub fn effective(&self, cluster: &str) -> Option<&ProtectedHeaderSet>
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.
Sourcepub fn proposed(
&self,
cluster: &str,
version: ProtectedHeaderVersion,
) -> Option<Option<&ProtectedHeaderSet>>
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.
Sourcepub fn accept(
&mut self,
cluster: &str,
version: ProtectedHeaderVersion,
) -> Resolution
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.
Sourcepub fn reject(
&mut self,
cluster: &str,
version: ProtectedHeaderVersion,
) -> Resolution
pub fn reject( &mut self, cluster: &str, version: ProtectedHeaderVersion, ) -> Resolution
version failed: drop it and fall back to what is left.