Skip to main content

AtomicDraftStore

Trait AtomicDraftStore 

Source
pub trait AtomicDraftStore: Send {
    // Required methods
    fn receipt(&self, draft: &str) -> Result<Option<Execution>, DraftError>;
    fn approval(
        &self,
        draft: &ApprovedDraft,
    ) -> Result<ApprovalEvidence, DraftError>;
    fn commit(
        &mut self,
        draft: &ApprovedDraft,
        transition: &ApprovalTransition,
    ) -> Result<Execution, DraftError>;
    fn acknowledged(&self, draft: &str) -> Result<bool, DraftError>;
    fn acknowledge(
        &mut self,
        draft: &str,
        receipt: &Execution,
    ) -> Result<(), DraftError>;
    fn pending_acknowledgments(
        &self,
        limit: NonZeroUsize,
    ) -> Result<Vec<ApprovedDraft>, DraftError>;
    fn deliver_outcome(
        &mut self,
        draft: &ApprovedDraft,
        receipt: &Execution,
    ) -> Result<(), DraftError>;
}
Expand description

The existing registry’s atomic target interface; it owns all prepared bytes.

Implementations must bind draft id, grant, kind, id, action and digest to the stored prepared act. They revalidate the current target and exact words under the commit hold, and store a named refusal for missing/retired targets. Each owning registry executes its typed prepared command through this seam. The human words never select an unapproved dispatcher or command.

Required Methods§

Source

fn receipt(&self, draft: &str) -> Result<Option<Execution>, DraftError>

Reads a committed receipt by immutable draft id.

§Errors

Durable ledger read failure.

Source

fn approval( &self, draft: &ApprovedDraft, ) -> Result<ApprovalEvidence, DraftError>

Reads authenticated approver evidence for this exact draft and digest.

§Errors

Missing evidence or durable read failure; the act remains unapplied.

Source

fn commit( &mut self, draft: &ApprovedDraft, transition: &ApprovalTransition, ) -> Result<Execution, DraftError>

One durable operation applies the prepared target mutation, transition, receipt and outcome outbox, or commits a named refusal without mutation. Concurrent/replayed ids answer the first receipt. A stored digest, target, grant or words mismatch never applies a new mutation.

§Errors

Storage or execution failure. Business refusals are durable Execution values so another pull never attempts the rejected act again.

Source

fn acknowledged(&self, draft: &str) -> Result<bool, DraftError>

Whether Lys acknowledged this receipt; the marker survives restart.

§Errors

Durable ledger read failure.

Source

fn acknowledge( &mut self, draft: &str, receipt: &Execution, ) -> Result<(), DraftError>

Keeps the successful acknowledgment without changing the target again. A marker can be set only when receipt matches the committed outcome.

§Errors

Storage failure or a mismatching receipt.

Source

fn pending_acknowledgments( &self, limit: NonZeroUsize, ) -> Result<Vec<ApprovedDraft>, DraftError>

Reads at most limit locally committed but unacknowledged drafts. A close whose response was lost may already be absent from Lys’s page.

§Errors

Durable outbox read failure; no uncommitted act is returned here.

Source

fn deliver_outcome( &mut self, draft: &ApprovedDraft, receipt: &Execution, ) -> Result<(), DraftError>

Delivers the committed outbox through the retained state writer and inbox with server provenance. The same operation is idempotent after restart. An unrelated holder is never rebound from a request’s name.

§Errors

State or inbox delivery failure; the receipt remains committed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§