Skip to main content

ic_backup/ports/consistency/
mod.rs

1//! Current consistency validation port; no fence acquisition/release or default coordinator.
2
3use crate::model::consistency::{ConsistencyObservation, ConsistencyRequest};
4use thiserror::Error;
5
6/// Application-owned fresh capture consistency and exact retained fence validation.
7///
8/// Providers qualify actual authenticated context/full inventory/selection, stopped
9/// and drained targets, challenge freshness and prior approved per-call accounting.
10/// Coordinated results additionally qualify currently active exact fence identity,
11/// membership revision, whole-unit write/membership/timer/external-work fencing and
12/// drained work, with continuous retained custody across interruption/capture.
13/// Sequential stops or matching hashes/revisions alone cannot prove that guarantee.
14/// No provider is installed. This port observes existing obligations; it does not
15/// acquire/release fences, restart targets, sign/dispatch capture, settle lost replies
16/// or qualify restore/payment safety. Failure, timeout, process death and dropping
17/// requests/results never release the integration's retained fence obligations.
18/// Terminal replay must not invoke this provider; fresh live verification is separate.
19pub trait ConsistencyProvider {
20    /// Validate current evidence for the exact original requested guarantee and capture boundary.
21    /// # Errors
22    /// Unavailable/unsupported reject before effects; indeterminate retains consumed
23    /// spending, evidence and fence obligations and stops without retry or release.
24    fn observe_consistency(
25        &mut self,
26        request: &ConsistencyRequest<'_>,
27    ) -> Result<ConsistencyObservation, ConsistencyProviderError>;
28}
29/// Redacted provider denial; no failure changes allowances or releases an obligation.
30#[derive(Clone, Copy, Debug, Eq, Error, PartialEq)]
31pub enum ConsistencyProviderError {
32    /// Required qualified provider absent; no remote effects.
33    #[error("consistency provider unavailable")]
34    Unavailable,
35    /// Cannot satisfy original guarantee; reject before remote effects.
36    #[error("consistency contract unsupported")]
37    Unsupported,
38    /// Actual evidence/reply/accounting uncertain; retain obligations and stop.
39    #[error("consistency observation indeterminate")]
40    Indeterminate,
41}