pub struct DualFrontier { /* private fields */ }Expand description
One published durable frontier: an application and an administration position.
None in either component means that space has never advanced. The
canonical encoding tags presence explicitly so an unchanged frontier is
never confused with a zero sequence.
Comparison is the componentwise (product) order and is deliberately
partial: a pair whose application component rises while its
administration component falls is incomparable, not “greater”. Every
caller that needs “does this advance?” must use DualFrontier::advances_from,
which answers false for an incomparable pair. This is the same fail-closed
discipline crate::ProjectionFrontier::satisfies applies across
incarnations: an unproven relation is never treated as satisfied.
Implementations§
Source§impl DualFrontier
impl DualFrontier
Sourcepub const fn new(
application: Option<CommitSequence>,
administration: Option<AdministrationSequence>,
) -> Self
pub const fn new( application: Option<CommitSequence>, administration: Option<AdministrationSequence>, ) -> Self
Builds a frontier pair from its two independently optional components.
Sourcepub const fn application(self) -> Option<CommitSequence>
pub const fn application(self) -> Option<CommitSequence>
Returns the published application commit-sequence component.
Sourcepub const fn administration(self) -> Option<AdministrationSequence>
pub const fn administration(self) -> Option<AdministrationSequence>
Returns the published administration-sequence component.
Sourcepub const fn is_initial(self) -> bool
pub const fn is_initial(self) -> bool
Returns true when nothing has ever been published.
Sourcepub fn advances_from(self, predecessor: Self) -> bool
pub fn advances_from(self, predecessor: Self) -> bool
Returns true when self is a strict successor of predecessor.
Both components must be greater than or equal to the predecessor’s and
at least one must be strictly greater. An incomparable pair — one
component up, the other down — answers false.
Sourcepub const fn to_canonical_bytes(self) -> [u8; 18]
pub const fn to_canonical_bytes(self) -> [u8; 18]
Returns the canonical DUAL_FRONTIER_BYTES-byte encoding.
Layout: [app presence][app u64 BE][admin presence][admin u64 BE].
An absent component encodes its presence tag plus eight zero bytes, so
“unchanged” is explicit rather than inferred.
Sourcepub fn from_canonical_bytes(bytes: [u8; 18]) -> Result<Self, DualFrontierError>
pub fn from_canonical_bytes(bytes: [u8; 18]) -> Result<Self, DualFrontierError>
Decodes a canonical encoding, failing closed on any noncanonical shape.