Skip to main content

ClaimState

Struct ClaimState 

Source
pub struct ClaimState {
Show 17 fields pub claim_id: ClaimId, pub subject: EntityRef, pub predicate: Predicate, pub value: ClaimValue, pub authority: Authority, pub ttl: Ttl, pub freshness_anchor: TimestampMillis, pub valid_to: Option<TimestampMillis>, pub lifecycle: ClaimLifecycle, pub created_at: TimestampMillis, pub updated_at: TimestampMillis, pub last_event_id: ClaimEventId, pub superseded_by: Option<ClaimId>, pub contradicted_by: Vec<ClaimId>, pub evidence_count: usize, pub corroborating_sources: BTreeMap<SourceId, AuthorityLevel>, pub survived_challenges: BTreeMap<SourceId, AuthorityLevel>,
}
Expand description

The current projected state of a claim — the fold of its event stream. Serializable so a backend may materialize it (cache it as a derived row) or transmit it; it remains a pure projection of the log, never an independent source of truth.

Fields§

§claim_id: ClaimId§subject: EntityRef§predicate: Predicate§value: ClaimValue§authority: Authority

Entrenchment of the incumbent claim, captured at assertion. Drives authority-weighted supersession arbitration; see docs/belief-revision.md.

§ttl: Ttl

TTL captured at assertion, used by ClaimState::is_expired_at for read-time freshness evaluation.

§freshness_anchor: TimestampMillis

Valid-time anchor for TTL freshness: valid_from, else observed_at, else the assertion’s recorded_at.

§valid_to: Option<TimestampMillis>

Valid-time upper bound captured at assertion (ADR 0016): the instant the fact is asserted to stop holding. Read-time freshness treats an elapsed valid_to exactly like an elapsed TTL; lifecycle is untouched. #[serde(default)] so projections materialized before the field existed still deserialize.

§lifecycle: ClaimLifecycle§created_at: TimestampMillis§updated_at: TimestampMillis§last_event_id: ClaimEventId§superseded_by: Option<ClaimId>§contradicted_by: Vec<ClaimId>§evidence_count: usize§corroborating_sources: BTreeMap<SourceId, AuthorityLevel>

The distinct provenance sources that have asserted or reinforced this exact value, each mapped to the highest authority it backed at. This measures same-value corroboration only — surviving a challenge is the separate entrenchment signal tracked in ClaimState::survived_challenges (ADR 0015). The asserter is the first entry.

§survived_challenges: BTreeMap<SourceId, AuthorityLevel>

The distinct sources whose challenge against this claim the firewall rejected, each mapped to the highest effective authority it challenged at (ADR 0015) — the “attacked and stood” half of earned entrenchment. #[serde(default)] so projections materialized before the field existed still deserialize.

Implementations§

Source§

impl ClaimState

Source

pub fn corroboration(&self) -> usize

Raw earned-entrenchment degree: the number of distinct sources backing this value. Sybil-inflatable on its own (an attacker minting many sources raises it), so security decisions should use ClaimState::corroboration_at_or_above to count only sufficiently-authoritative backers.

Source

pub fn corroboration_at_or_above(&self, min: AuthorityLevel) -> usize

Authority-weighted corroboration: the number of distinct backing sources whose authority is at least min. This is the Sybil-resistant entrenchment signal — minting low-authority sources cannot raise the count measured at a higher floor.

Source

pub fn survived_challenge_count(&self) -> usize

Raw survived-challenge degree: distinct sources whose challenge this claim survived. Sybil-inflatable like ClaimState::corroboration; security decisions should use ClaimState::survived_challenges_at_or_above.

Source

pub fn survived_challenges_at_or_above(&self, min: AuthorityLevel) -> usize

Authority-weighted survived challenges: distinct challengers whose effective authority was at least min when they challenged and lost. Minting low-authority challengers cannot simulate surviving strong attacks.

Source

pub fn expires_at(&self) -> Option<TimestampMillis>

When this claim stops being fresh, if ever: the earliest of its TTL bound (relative to the freshness anchor) and its asserted valid_to (ADR 0016).

Source

pub fn is_expired_at(&self, now: TimestampMillis) -> bool

Whether the claim’s freshness has elapsed at now — its TTL ran out or its asserted validity ended. A claim with Ttl::Never and no valid_to is never expired. This is the read-time freshness predicate; it does not consult lifecycle (a superseded claim can still be “unexpired” by TTL).

Trait Implementations§

Source§

impl Clone for ClaimState

Source§

fn clone(&self) -> ClaimState

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 Debug for ClaimState

Source§

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

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

impl<'de> Deserialize<'de> for ClaimState

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 Eq for ClaimState

Source§

impl PartialEq for ClaimState

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ClaimState

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 ClaimState

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<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, 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.