Skip to main content

AnchorState

Enum AnchorState 

Source
pub enum AnchorState {
    Unanchored,
    Valid,
    Drifted,
    Vanished,
    Unverifiable,
}
Expand description

What a record’s anchor is worth right now, computed on every read against the current graph and never stored.

A stored verdict would have to be rewritten on every sync — and would be wrong in between — which is the same reason ADR-0013 keeps decay out of the table. None of these states deletes anything: see the module docs for why a record about vanished code is kept and marked rather than pruned.

This is also the scope test. AnchorState::applies is what decides whether a record applies to the tree in front of you — see the module docs. The two “no useful anchor” situations are deliberately separate states with opposite answers, because conflating them is the mistake that would make the rule meaningless:

Variants§

§

Unanchored

No anchor was ever recorded — a general lesson about the repository (“CI is Ubuntu-only”), tied to nothing in particular and therefore true wherever the repository is. Applies.

Not to be confused with an anchor that failed to resolve: this record never claimed to be about a specific piece of code, so there is nothing for a tree to disagree with.

§

Valid

The anchored node is present and carries the blob captured at write time: the association is in this tree in the same format. Applies.

§

Drifted

The anchored node is present but carries a different blob: the code changed underneath the record. It may still be right; it is no longer evidence about what is there now, and it does not apply to this tree.

§

Vanished

The anchored node is gone from the graph. The most interesting state, and the one the authored layer would have pruned. Does not apply here — and is kept anyway, because a lesson about deleted code is often the most valuable one.

§

Unverifiable

The anchored node is present, but no blob was captured (or the node carries none), so the blob cannot be compared either way. Reported honestly rather than folded into AnchorState::Valid, which would claim a check that never happened.

Does not apply, by the same strictness that makes [AnchorState:: Drifted] not apply: the rule is that the association is present in the same format, and an unmeasurable blob cannot demonstrate that. Failing toward marked is the whole point — the alternative silently applies a lesson to code nobody checked.

Implementations§

Source§

impl AnchorState

Source

pub fn as_str(self) -> &'static str

Stable string token used in --json output.

Source

pub fn applies(self) -> bool

Whether this record applies to the tree it was just resolved against.

The whole scope rule, in one predicate: a record applies when it is anchored to nothing (a general lesson) or when its anchor resolves here with the same blob. Everything else — vanished, drifted, unmeasurable — means the association is not present in this tree in the same format, so the record does not apply here. It is still stored, still listed, and still applies wherever its anchor does resolve.

Note what this predicate does not consult: the branch the record was written on, its created_at, its scope, or its position in the sequence. None of those is available to it, which is the point — applicability is a question about the tree, asked fresh every read.

Source

pub fn is_stale(self) -> bool

Whether the anchored code has moved out from under this record — the evidence-first signal ADR-0013 depreciates on. Never a delete condition; a stale record is kept, marked, and (in a later stage) ranked lower.

Narrower than the negation of AnchorState::applies: staleness means the code moved, which AnchorState::Unverifiable does not claim — nothing was measured there. A record can fail to apply without anything having gone stale.

Trait Implementations§

Source§

impl Clone for AnchorState

Source§

fn clone(&self) -> AnchorState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AnchorState

Source§

impl Debug for AnchorState

Source§

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

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

impl<'de> Deserialize<'de> for AnchorState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for AnchorState

Source§

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

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

impl Eq for AnchorState

Source§

impl PartialEq for AnchorState

Source§

fn eq(&self, other: &AnchorState) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for AnchorState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AnchorState

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<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.