commerce_dispatch.rs (3351B)
1 //! Owned original dispatch and retained refusal IO, without release authority. 2 use super::*; 3 use radroots_signing::{ 4 issuance::{ExactIssuer, RejectedArtifact, SignedArtifact}, 5 provider::ProviderError, 6 }; 7 8 /// The host's newly confirmed single-use claim owns its original issuer call. 9 /// Existing claim reports and recovery refusals cannot construct this port. 10 pub trait AcceptanceDispatch: HostBound { 11 /// Original claim, checked by Core before any invocation. 12 fn claim(&self) -> AcceptanceClaim; 13 /// Consumes this permit and invokes the selected issuer once. 14 fn dispatch<'a>( 15 self: Box<Self>, 16 issuer: &'a dyn ExactIssuer, 17 cancellation: CancellationSignal, 18 ) -> HostFuture<'a, Result<AcceptanceDispatchOutcome, OperationError>>; 19 } 20 21 /// Original invocation facts; none claims durable capture or installation. 22 pub enum AcceptanceDispatchOutcome { 23 /// Exact signed material, which must remain owned through persistence. 24 Obtained(AcceptanceClaim, SignedArtifact), 25 /// Owned original refusal; capture has not yet been confirmed. 26 Unissued(Box<dyn AcceptanceUnissued>), 27 /// Original invocation remains uncertain; keep its stock claim. 28 Unknown(AcceptanceClaim, ProviderError), 29 /// Bounded diagnostic from a rejected callback, never nonissuance proof. 30 Rejected(AcceptanceClaim, RejectedArtifact), 31 } 32 33 /// Authenticated original-invocation fact reported by the concrete store. 34 /// Public report data grants no dispatch, abort, release or capture authority. 35 #[derive(Clone, Copy, Debug, Eq, PartialEq)] 36 pub struct AcceptanceUnissuedReceipt { 37 /// Actual confirmed capture transaction and original operation identity. 38 pub attempt: CommitAttempt, 39 /// Original protected signing claim. 40 pub claim: radroots_domain::SigningAttemptId, 41 /// Original exact recipient. 42 pub recipient: radroots_domain::PublicKey, 43 /// Original invocation's reported refusal. 44 pub reason: ProviderError, 45 /// Authenticated capture checkpoint, without allocation authority. 46 pub checkpoint: radroots_storage::inventory::InventoryCheckpointRef, 47 } 48 49 /// Actual durable completion, kept distinct from original signer observation. 50 pub enum AcceptanceUnissuedOutcome { 51 /// Original fact was durably retained with a confirmed transaction. 52 Committed(Box<AcceptanceUnissuedReceipt>), 53 /// Actual capture transaction has uncertain completion. 54 Unknown(CommitAttempt), 55 } 56 57 /// Owns the target's original invocation observation and retained capture proof. 58 /// Implementations must originate in that host's consumed fresh dispatch and 59 /// preserve the original material across failed writes and same-owner recovery. 60 /// Implementing this port does not qualify an arbitrary issuer's honesty. 61 pub trait AcceptanceUnissued: HostBound { 62 /// Original claim, never permission to invoke again. 63 fn claim(&self) -> AcceptanceClaim; 64 /// Original invocation's independently retained refusal reason. 65 fn reason(&self) -> ProviderError; 66 /// Captures borrowed original proof without fresh signing or permission. 67 fn capture(&self) -> HostFuture<'_, Result<AcceptanceUnissuedOutcome, OperationError>>; 68 /// Reconciles original material on its retained target owner. 69 fn reconcile(&self) -> HostFuture<'_, Result<AcceptanceUnissuedOutcome, OperationError>>; 70 }