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
impl ApprovalLedgerTestOnly
Sourcepub fn open(
&self,
set: ApprovalSetTestOnly,
) -> Result<(), ApprovalErrorTestOnly>
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.
Sourcepub fn record_approval(
&self,
set_id: &str,
slot: usize,
decision: Option<&Arc<V2ReleasedDecision>>,
bundle_wire: &[u8],
) -> Result<bool, ApprovalErrorTestOnly>
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.
Sourcepub fn execute(
&self,
ctx: &V2Context,
set_id: &str,
clock: &dyn V2AuthoritativeClock,
) -> Result<(), ApprovalErrorTestOnly>
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.