Skip to main content

ic_backup/ports/snapshot_read/
mod.rs

1//! Fallible current snapshot-read permission observation; no installed provider.
2
3use crate::model::snapshot_read::{SnapshotReadObservation, SnapshotReadRequest};
4use thiserror::Error;
5
6/// Integration-owned authenticated snapshot visibility and optional complete controller evidence.
7///
8/// Implementations qualify actual context/target/snapshot visibility, exact viewer
9/// identities, controller evidence when used, challenge freshness, coherent custody
10/// and prior approved per-call accounting. Status/log visibility and Root-configured
11/// declarations cannot stand in for current snapshot settings. Unknown visibility
12/// must fail. A result does not perform the requested list or prove effect settlement,
13/// transfer completeness, mutation control, lifecycle safety or application fencing.
14/// No default provider or paid-call workflow is installed. Terminal replay must not
15/// invoke this port; fresh live verification is a separate operation.
16pub trait SnapshotReadProvider {
17    /// Observe permissions for exact original-operation-bound snapshot-list bytes.
18    /// # Errors
19    /// Unavailable/unsupported reject before effects; indeterminate retains consumed
20    /// spending/evidence and stops without retry. A missing required provider fails unavailable.
21    fn observe_snapshot_read(
22        &mut self,
23        request: &SnapshotReadRequest<'_>,
24    ) -> Result<SnapshotReadObservation, SnapshotReadProviderError>;
25}
26/// Redacted provider failure; no error grants dispatch or replenishment.
27#[derive(Clone, Copy, Debug, Eq, Error, PartialEq)]
28pub enum SnapshotReadProviderError {
29    /// No qualified provider; reject before remote effects.
30    #[error("snapshot read provider unavailable")]
31    Unavailable,
32    /// Cannot satisfy the contract; reject before remote effects.
33    #[error("snapshot read contract unsupported")]
34    Unsupported,
35    /// Actual observation/reply/accounting uncertain; retain evidence and stop.
36    #[error("snapshot read observation indeterminate")]
37    Indeterminate,
38}