Skip to main content

Store

Struct Store 

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

The reference Part B store. All methods are safe for concurrent use; every operation runs under one mutex, which makes the claim and the stream-sequence advance one atomic step, and terminal commit and outbox sequence assignment another. TEST/REFERENCE ONLY.

Implementations§

Source§

impl Store

Source

pub fn corrupt_sealed_state_test_only(&self, claim_id: &str)

Go CorruptSealedStateTestOnly: flip one byte of a committed claim’s sealed terminal result, modelling corrupted primary storage.

Source§

impl Store

Source

pub fn new( now: i64, lease_seconds: i64, log_id: &str, verifier_key: &HybridPrivateKey, ) -> V2Result<Store>

Go NewStore: a reference store whose authoritative clock starts at now, whose evaluator leases last lease_seconds, and whose receipt log log_id is signed by verifier_key.

Source

pub fn clone_store(&self) -> Store

Go Clone: an independent copy of the complete state, modelling a restore that exactly equals the anchored state. The anchor is not copied.

Source

pub fn set_time(&self, now: i64)

Go SetTime: set the authoritative clock. Tests may move it backward to exercise clock-regression handling.

Source

pub fn now(&self) -> i64

Go Now: the clock setting without an authoritative reading.

Source

pub fn set_signer_failure(&self, failing: bool)

Go SetSignerFailure: make the reference receipt signer fail (or recover). A failed publication appends nothing.

Source

pub fn set_acknowledgement_withheld(&self, withheld: bool)

Go SetAcknowledgementWithheld: stop (or resume) submitting appended entries to the checkpoint. Resuming acknowledges every pending entry in log order at the current clock.

Source

pub fn log_length(&self) -> usize

Go LogLength: the number of appended (signed) receipts.

Source

pub fn plant_release_test_only(&self, claim_id: &str, ack_timestamp: i64)

Go PlantReleaseTestOnly: write a release record for claim_id directly, bypassing release and anchoring (models an attacker who can write the primary’s storage).

Source

pub fn abandon_pending_receipts(&self) -> Vec<String>

Go AbandonPendingReceipts: freeze the receipt log and mark every claim whose committed outbox entry was not yet appended as receipt_abandoned. Returns the abandoned claim IDs in log order.

Source

pub fn with_rate_at_finalization( self: &Arc<Self>, ) -> Arc<RateAtFinalizationStore> ⓘ

Go WithRateAtFinalization: enable rate admission at finalization and return the view that advertises it. Use the view as both the claim store and the rate store.

Trait Implementations§

Source§

impl ClaimStoreV2 for Store

Source§

fn claim_v2( &self, _ctx: &V2Context, claim: V2ChallengeClaim, ) -> Result<V2ClaimResult, V2StoreError>

The atomic claim: a claim ID not derived from its replay key is configuration_invalid and creates nothing; then the authoritative clock reading (a regressed clock creates nothing and fails with claim_store_unavailable), replay key check, authoritative freshness recheck, stream-sequence advance, and insertion, all under one lock.

Source§

fn finalize_v2_claim( &self, _ctx: &V2Context, claim_id: &str, owner_token: &[u8], terminal_result: &[u8], receipt_body: &[u8], allow_valid_until: i64, ) -> Result<bool, V2StoreError>

Commit the evaluator’s terminal result while its lease is live, reading T_final inside the same critical section. The receipt body must bind the sealed claim (validate_v2_finalization_payload: malformed or configuration_invalid otherwise, committing nothing). A regressed clock fails with clock_regressed; an allow is rejected at or beyond its horizon or the challenge expiry. With rate admission at finalization, an allow is admitted against the sealed rate batch here and fails with the exact V2StoreError::RateLimitExceeded, committing nothing, when a counter is exhausted. An identical repeat returns Ok(false).

Source§

fn record_v2_evaluation_progress( &self, _ctx: &V2Context, claim_id: &str, owner_token: &[u8], progress: V2EvaluationProgress, ) -> Result<(), V2StoreError>

The owner’s progress is stored only while the claim is evaluating and its lease is live.

Source§

fn load_v2_interrupted_claim( &self, _ctx: &V2Context, claim_id: &str, ) -> Result<V2InterruptedClaim, V2StoreError>

Refuses while the lease is live, so the returned progress is final. A terminal claim is returned too (idempotent recovery).

Source§

fn recover_interrupted_v2_claim( &self, _ctx: &V2Context, claim_id: &str, terminal_result: &[u8], receipt_body: &[u8], ) -> Result<bool, V2StoreError>

Commit the canonical interrupted result after the lease expired. The result and receipt body are validated exactly as finalization validates them (validate_v2_finalization_payload: malformed or configuration_invalid), and the decision and reason must be indeterminate / evaluation_interrupted (configuration_invalid otherwise); a refused recovery commits nothing (SPEC-v2 §7.5).

Source§

fn rate_at_finalization_view(&self) -> Option<&dyn V2RateAtFinalizationStore>

Go’s store.(V2RateAtFinalizationStore) type assertion: a store that implements V2RateAtFinalizationStore returns Some(self).
Source§

impl Debug for Store

Source§

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

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

impl V2AuthoritativeClock for Store

Source§

fn authoritative_time_v2(&self, _ctx: &V2Context) -> Result<i64, V2StoreError>

A regressed clock fails with clock_regressed.

Source§

impl V2CommittedClaimStore for Store

Returns a terminal claim exactly as its terminal commit persisted it, for resumption after the handoff was lost (SPEC-v2 §7.11). A claim still evaluating is claim_lease_live while its lease is live and claim_lease_lost after, when lease-expiry recovery must run first.

Source§

impl V2ReceiptCheckpoint for Store

Source§

fn acknowledge_v2_receipt( &self, _ctx: &V2Context, log_id: &str, sequence: i64, previous_entry_hash: &[u8], entry_hash: &[u8], ) -> Result<V2CheckpointAcknowledgement, V2StoreError>

Accept only the next appended entry of the log, linked by previous_entry_hash, and return the original acknowledgement for an identical retry. A different entry hash at an acknowledged sequence is a fork (SPEC-v2 §7.8): it is refused and freezes the log, after which the checkpoint acknowledges nothing further for it, neither here nor from the publisher’s submissions. Identical retries of acknowledgements made before the fork still return the original acknowledgement.

Source§

fn get_v2_acknowledgement( &self, _ctx: &V2Context, log_id: &str, sequence: i64, ) -> Result<V2CheckpointAcknowledgement, V2StoreError>

Source§

impl V2ReceiptPublisher for Store

Source§

fn publish_v2_receipt( &self, _ctx: &V2Context, claim_id: &str, receipt_body: &[u8], ) -> Result<Vec<u8>, V2StoreError>

Sign and append the committed outbox body for claim_id at the log position assigned at terminal commit, or return the receipt already appended. A different body is refused, an earlier unpublished entry blocks it, and a failing signer or frozen log appends nothing.

Source§

impl V2ReleaseClaimStore for Store

Source§

fn record_v2_release( &self, _ctx: &V2Context, release: V2ReleaseRecord, ) -> Result<(), V2StoreError>

Records a release or a withheld result (SPEC-v2 §6.9): the first record for a claim wins, an identical repeat is a no-op, and any different record is V2StoreError::ReleaseStateMismatch. A new record is a durable security-state change, anchored like any other.

Source§

fn load_v2_terminal_claim( &self, _ctx: &V2Context, claim_id: &str, ) -> Result<V2TerminalClaimRecord, V2StoreError>

Auto Trait Implementations§

§

impl !Freeze for Store

§

impl Forget for Store

§

impl RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl UnwindSafe for Store

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.