lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README

ports.rs (6099B)


      1 //! Shared journal dispatch uses the actual browser owner, never another engine.
      2 use super::BrowserWorkspace;
      3 use radroots_domain::{CommandDigest, OperationId};
      4 use radroots_storage::{
      5     command::{
      6         AdmissionOutcome, AdmissionRequest, ArtifactEvidence, BoundSigningPlan, CapturedArtifact,
      7         CapturedSigningPlan, ClaimAttemptOutcome, ClaimAttemptRequest, DeliveryAttempt,
      8         DeliveryAttemptOutcome, DeliveryAttemptRequest, DeliveryObservation,
      9         DeliveryObservationOutcome, EnvelopeCandidate, EvidenceCaptureOutcome, InstallationOutcome,
     10         InstallationRequest, OperationError, OperationJournal, OperationSnapshot,
     11         PlanBindingOutcome, PreparedOperation, SigningAttempt, SigningTarget,
     12     },
     13     workspace::{AttachmentInput, AttachmentProof, WorkspaceBinding},
     14 };
     15 use radroots_transport::{BoxFuture, sink::DeliveryRequestId};
     16 
     17 impl OperationJournal for BrowserWorkspace {
     18     fn reconcile_unknown<'a>(
     19         &'a self,
     20         input: AttachmentInput,
     21         proof: &'a AttachmentProof,
     22         evidence: &'a ArtifactEvidence,
     23     ) -> BoxFuture<'a, Result<EvidenceCaptureOutcome, OperationError>> {
     24         Box::pin(BrowserWorkspace::capture_evidence(
     25             self, input, proof, evidence,
     26         ))
     27     }
     28     fn record_delivery_observation(
     29         &self,
     30         binding: WorkspaceBinding,
     31         proof: AttachmentProof,
     32         observation: DeliveryObservation,
     33     ) -> BoxFuture<'_, Result<DeliveryObservationOutcome, OperationError>> {
     34         Box::pin(BrowserWorkspace::record_delivery_observation(
     35             self,
     36             binding,
     37             proof,
     38             observation,
     39         ))
     40     }
     41     fn delivery_observations(
     42         &self,
     43         binding: WorkspaceBinding,
     44         operation: OperationId,
     45         digest: CommandDigest,
     46         target: SigningTarget,
     47         request: DeliveryRequestId,
     48         proof: AttachmentProof,
     49     ) -> BoxFuture<'_, Result<Vec<DeliveryObservation>, OperationError>> {
     50         Box::pin(BrowserWorkspace::delivery_observations(
     51             self, binding, operation, digest, target, request, proof,
     52         ))
     53     }
     54     fn prepare_delivery_attempt<'a>(
     55         &'a self,
     56         request: DeliveryAttemptRequest,
     57         proof: AttachmentProof,
     58         candidate: Option<&'a EnvelopeCandidate>,
     59     ) -> BoxFuture<'a, Result<DeliveryAttemptOutcome, OperationError>> {
     60         Box::pin(BrowserWorkspace::prepare_delivery_attempt(
     61             self, request, proof, candidate,
     62         ))
     63     }
     64     fn delivery_attempt(
     65         &self,
     66         binding: WorkspaceBinding,
     67         operation: OperationId,
     68         digest: CommandDigest,
     69         target: SigningTarget,
     70         request: DeliveryRequestId,
     71         proof: AttachmentProof,
     72     ) -> BoxFuture<'_, Result<Option<DeliveryAttempt>, OperationError>> {
     73         Box::pin(BrowserWorkspace::delivery_attempt(
     74             self, binding, operation, digest, target, request, proof,
     75         ))
     76     }
     77     fn install_transition_and_outbox(
     78         &self,
     79         request: InstallationRequest,
     80         proof: AttachmentProof,
     81     ) -> BoxFuture<'_, Result<InstallationOutcome, OperationError>> {
     82         Box::pin(BrowserWorkspace::install_transition_and_outbox(
     83             self, request, proof,
     84         ))
     85     }
     86     fn operation_snapshot(
     87         &self,
     88         binding: WorkspaceBinding,
     89         operation: OperationId,
     90         digest: Option<CommandDigest>,
     91         proof: AttachmentProof,
     92     ) -> BoxFuture<'_, Result<Option<OperationSnapshot>, OperationError>> {
     93         Box::pin(BrowserWorkspace::operation_snapshot(
     94             self, binding, operation, digest, proof,
     95         ))
     96     }
     97     fn claim_attempt(
     98         &self,
     99         request: ClaimAttemptRequest,
    100         proof: AttachmentProof,
    101     ) -> BoxFuture<'_, Result<ClaimAttemptOutcome, OperationError>> {
    102         Box::pin(BrowserWorkspace::claim_attempt(self, request, proof))
    103     }
    104     fn signing_attempt(
    105         &self,
    106         request: ClaimAttemptRequest,
    107         proof: AttachmentProof,
    108     ) -> BoxFuture<'_, Result<Option<SigningAttempt>, OperationError>> {
    109         Box::pin(BrowserWorkspace::signing_attempt(self, request, proof))
    110     }
    111     fn capture_evidence<'a>(
    112         &'a self,
    113         input: AttachmentInput,
    114         proof: &'a AttachmentProof,
    115         evidence: &'a ArtifactEvidence,
    116     ) -> BoxFuture<'a, Result<EvidenceCaptureOutcome, OperationError>> {
    117         Box::pin(BrowserWorkspace::capture_evidence(
    118             self, input, proof, evidence,
    119         ))
    120     }
    121     fn obtained_evidence(
    122         &self,
    123         request: ClaimAttemptRequest,
    124         proof: AttachmentProof,
    125     ) -> BoxFuture<'_, Result<Option<CapturedArtifact>, OperationError>> {
    126         Box::pin(BrowserWorkspace::obtained_evidence(self, request, proof))
    127     }
    128     fn bind_signing_intents(
    129         &self,
    130         binding: WorkspaceBinding,
    131         plan: CapturedSigningPlan,
    132         proof: AttachmentProof,
    133     ) -> BoxFuture<'_, Result<PlanBindingOutcome, OperationError>> {
    134         Box::pin(BrowserWorkspace::bind_signing_intents(
    135             self, binding, plan, proof,
    136         ))
    137     }
    138     fn signing_plan(
    139         &self,
    140         binding: WorkspaceBinding,
    141         operation: OperationId,
    142         digest: CommandDigest,
    143         proof: AttachmentProof,
    144     ) -> BoxFuture<'_, Result<Option<BoundSigningPlan>, OperationError>> {
    145         Box::pin(BrowserWorkspace::signing_plan(
    146             self, binding, operation, digest, proof,
    147         ))
    148     }
    149     fn admit_command_and_hold(
    150         &self,
    151         request: AdmissionRequest,
    152         proof: AttachmentProof,
    153     ) -> BoxFuture<'_, Result<AdmissionOutcome, OperationError>> {
    154         Box::pin(BrowserWorkspace::admit_command_and_hold(
    155             self, request, proof,
    156         ))
    157     }
    158     fn operation(
    159         &self,
    160         binding: WorkspaceBinding,
    161         operation: OperationId,
    162         digest: Option<CommandDigest>,
    163         proof: AttachmentProof,
    164     ) -> BoxFuture<'_, Result<Option<PreparedOperation>, OperationError>> {
    165         Box::pin(BrowserWorkspace::operation(
    166             self, binding, operation, digest, proof,
    167         ))
    168     }
    169 }