lib

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

operations.rs (3127B)


      1 //! Current authenticated reads of original retained operations.
      2 use crate::{Client, OperationId, Result, WorkspaceSession};
      3 use radroots_domain::CommandDigest;
      4 
      5 /// Reads are scoped to one explicit client-owned authenticated attachment.
      6 pub struct Operations<'a> {
      7     client: &'a Client,
      8     scope: WorkspaceSession,
      9 }
     10 impl<'a> Operations<'a> {
     11     /// Explicitly requests original preparation cleanup. Only the selected
     12     /// store can prove original nonissuance and replay absence, then release
     13     /// the exact hold while retaining the original claims and facts.
     14     /// This is separate from business cancellation and stopping delivery.
     15     pub async fn abort_proven_unissued(
     16         &self,
     17         minimum: radroots_storage::inventory::InventoryCheckpointRef,
     18         operation: OperationId,
     19         digest: CommandDigest,
     20     ) -> Result<radroots_storage::inventory::StockAbortOutcome> {
     21         self.client
     22             .session
     23             .abort_proven_unissued(
     24                 self.client.inventory()?,
     25                 &self.scope,
     26                 minimum,
     27                 operation,
     28                 digest,
     29             )
     30             .await
     31     }
     32     /// Reads original cleanup. Absence never permits issuance or release.
     33     pub async fn preparation_abort(
     34         &self,
     35         minimum: radroots_storage::inventory::InventoryCheckpointRef,
     36         operation: OperationId,
     37         digest: CommandDigest,
     38     ) -> Result<Option<radroots_storage::inventory::StockAbortReceipt>> {
     39         self.client
     40             .session
     41             .stock_preparation_abort(
     42                 self.client.inventory()?,
     43                 &self.scope,
     44                 minimum,
     45                 operation,
     46                 digest,
     47             )
     48             .await
     49     }
     50     /// Explicitly resumes one original command. Retained signing claims never
     51     /// permit reissuance. Delivery retries use the original exact artifact and
     52     /// criterion, preserving accepted targets and the original business result.
     53     pub async fn resume(
     54         &self,
     55         operation: OperationId,
     56         expected: Option<CommandDigest>,
     57     ) -> crate::ExecutionResult<radroots_execution::OperationStatus> {
     58         self.client
     59             .session
     60             .resume_command(self.client.journal()?, &self.scope, operation, expected)
     61             .await
     62     }
     63     pub(crate) const fn new(client: &'a Client, scope: WorkspaceSession) -> Self {
     64         Self { client, scope }
     65     }
     66     /// Reads current original progress. Absence is not safe-nonissuance proof.
     67     pub async fn get(
     68         &self,
     69         operation: OperationId,
     70     ) -> Result<Option<radroots_execution::OperationStatus>> {
     71         self.get_matching(operation, None).await
     72     }
     73     /// Additionally requires the original semantic command commitment.
     74     pub async fn get_matching(
     75         &self,
     76         operation: OperationId,
     77         expected: Option<CommandDigest>,
     78     ) -> Result<Option<radroots_execution::OperationStatus>> {
     79         self.client
     80             .session
     81             .operation(self.client.journal()?, &self.scope, operation, expected)
     82             .await
     83     }
     84 }