Skip to main content

AttributionCensus

Struct AttributionCensus 

Source
pub struct AttributionCensus { /* private fields */ }
Expand description

Attribution census over every transaction row read.

Counted over all rows, not only the ones that verified, so a chain that breaks at row 5 still reports what the remaining rows claim about who acted. Those claims are only as good as the chain verdict beside them: unless it is Intact, treat every count here as unproven, and note that Self::rows can then exceed the verdict’s rows_checked. A row past the break may be perfectly authentic – a deleted or reordered row breaks the link while leaving every later signature valid – so the surplus is the part of the trail this command cannot vouch for, not proof of forgery. Self::rows exists so a reader can see that gap instead of inferring it.

One counter is not enough, because a row can name no account for reasons with different remedies. none:unattributed says the daemon tried and failed on a host that could have attributed the call, which is a configuration problem to chase in the daemon log. A v1 or v2 row says the encoding had no principal field when the row was signed, which is history and cannot be repaired: backfilling it would rewrite the bytes the signature covers. An unattested value says something wrote to the column that should not have.

Splitting them keeps the report honest on an upgraded database. A single “unattributed” count of 0 over a chain of pre-v3 rows reads as “every action is attributed” when in fact none of them is.

Fields are private and Self::of is the only constructor that reads rows, so a census cannot state totals that contradict the rows it describes. from_counts_for_tests is the one other way to build one, and it is not for production. That is not hypothetical tidiness: in 0.3.0 the MCP report built its own all-zero attribution count on the cannot_verify path, where a real count had already been computed, and the MCP tool and audit verify --json then published different numbers for one database.

Implementations§

Source§

impl AttributionCensus

Source

pub fn of(tx_rows: &[ChainRow]) -> Self

Count the rows. The only way to obtain a census of real data.

Source

pub fn named(&self) -> u64

Rows whose signed principal names an account (uid: or token:).

Names an account, which is not a person: see SECURITY.md on shared logins, su, uid reuse, and on token:vsock proving possession of a file.

Source

pub fn attribution_failed(&self) -> u64

Rows signing none:unattributed, the daemon’s admission that it could not name the caller.

Source

pub fn not_recorded(&self) -> u64

Rows with no principal the signature covers, normally written before the column existed.

Source

pub fn unattested(&self) -> u64

Rows carrying a principal no signature vouches for. Non-zero means investigate: nothing in SysKnife writes such a value.

Source

pub fn rows(&self) -> u64

Rows censused.

The four row outcomes partition the rows, and Self::of increments exactly one bucket per row, so this equals their sum. State the partition rather than the arithmetic: a fifth bucket keeps the partition true, and any sum written out by hand somewhere else would not survive it.

Source

pub fn unnamed(&self) -> u64

Rows that name no account, for any reason. What an operator asking “can this trail tell me who acted” has to subtract.

Subtraction rather than addition on purpose: a fifth non-naming bucket cannot make this number stale, whereas summing the reasons would need editing here too. A future bucket that does name an account would have to be added to named instead, which is why named is the one counter this subtracts.

Trait Implementations§

Source§

impl Clone for AttributionCensus

Source§

fn clone(&self) -> AttributionCensus

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 AttributionCensus

Source§

impl Debug for AttributionCensus

Source§

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

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

impl Eq for AttributionCensus

Source§

impl PartialEq for AttributionCensus

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AttributionCensus

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<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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more