Skip to main content

ApprovalLedgerTestOnly

Struct ApprovalLedgerTestOnly 

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

The dual-root application ledger. Safe for concurrent use; each operation is one atomic step under a mutex.

Implementations§

Source§

impl ApprovalLedgerTestOnly

Source

pub fn new() -> Self

An empty ledger.

Source

pub fn open( &self, set: ApprovalSetTestOnly, ) -> Result<(), ApprovalErrorTestOnly>

Go Open: record an approval set. It derives the agent and root key IDs and the expected session context from the set’s fields. The two root keys must be distinct: one root never counts twice.

Source

pub fn record_approval( &self, set_id: &str, slot: usize, decision: Option<&Arc<V2ReleasedDecision>>, bundle_wire: &[u8], ) -> Result<bool, ApprovalErrorTestOnly>

Go RecordApproval: bind a released decision and the exact proof bundle it verified to slot 0 or 1, and return whether both slots are now filled. Checks, in order: a released allow; the receipt’s bundle_hash equals the bundle’s hash; the claim is not already recorded in another set; the receipt and bundle name the set’s verifier and agent (complete key), the receipt names the set’s required scope, and the bundle’s session_context equals the context derived from the set; the chain’s terminal issuer key equals the slot’s pinned root key and the receipt’s issuer_ids contain that root; the slot is empty or holds this claim.

Source

pub fn execute( &self, ctx: &V2Context, set_id: &str, clock: &dyn V2AuthoritativeClock, ) -> Result<(), ApprovalErrorTestOnly>

Go Execute: atomically check that both approvals are recorded and each is still allowed at the receiver’s authoritative time, then mark the set executed. It succeeds at most once per set.

Trait Implementations§

Source§

impl Debug for ApprovalLedgerTestOnly

Source§

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

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

impl Default for ApprovalLedgerTestOnly

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.