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:
AnchorState::Unanchored— nothing was ever anchored. A general lesson about the repository, which applies everywhere.AnchorState::Vanished/AnchorState::Drifted/AnchorState::Unverifiable— an anchor was recorded and did not resolve here. The association is not present in this tree in the same form, so the record does not apply to it.
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
impl AnchorState
Sourcepub fn applies(self) -> bool
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.
Sourcepub fn is_stale(self) -> bool
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
impl Clone for AnchorState
Source§fn clone(&self) -> AnchorState
fn clone(&self) -> AnchorState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AnchorState
Source§impl Debug for AnchorState
impl Debug for AnchorState
Source§impl<'de> Deserialize<'de> for AnchorState
impl<'de> Deserialize<'de> for AnchorState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for AnchorState
impl Display for AnchorState
impl Eq for AnchorState
Source§impl PartialEq for AnchorState
impl PartialEq for AnchorState
Source§impl Serialize for AnchorState
impl Serialize for AnchorState
impl StructuralPartialEq for AnchorState
Auto Trait Implementations§
impl Freeze for AnchorState
impl RefUnwindSafe for AnchorState
impl Send for AnchorState
impl Sync for AnchorState
impl Unpin for AnchorState
impl UnsafeUnpin for AnchorState
impl UnwindSafe for AnchorState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.