Skip to main content

ic_backup/model/ic_observation/capture_settlement/
mod.rs

1//! Passive independently qualified original snapshot-capture claims.
2
3use crate::model::artifacts::ArtifactChecksumRecord;
4use std::fmt;
5
6/// Independent original capture attribution; candidate cardinality supplies no claim.
7#[derive(Clone)]
8pub enum IcCaptureAttribution {
9    /// Exclusive attribution to the exact original capture, retained through observation.
10    Applied {
11        /// Exact newly captured raw ID, distinct from every retained baseline ID.
12        snapshot_id: Vec<u8>,
13        /// Qualified evidence excluding independent creation by other writers.
14        attribution: ArtifactChecksumRecord,
15    },
16    /// The original capture never applied, including no transient capture then deletion.
17    NotApplied {
18        /// Qualified exclusion; an empty inventory delta is insufficient.
19        exclusion: ArtifactChecksumRecord,
20    },
21    /// An actually settled authenticated list cannot resolve the original capture.
22    Unresolved {
23        /// Settled uncertainty; lost, unavailable or malformed replies stay pending.
24        uncertainty: ArtifactChecksumRecord,
25    },
26}
27
28impl fmt::Debug for IcCaptureAttribution {
29    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
30        match self {
31            Self::Applied {
32                snapshot_id,
33                attribution,
34            } => formatter
35                .debug_struct("Applied")
36                .field("snapshot_id_bytes", &snapshot_id.len())
37                .field("attribution", attribution)
38                .finish(),
39            Self::NotApplied { exclusion } => formatter
40                .debug_struct("NotApplied")
41                .field("exclusion", exclusion)
42                .finish(),
43            Self::Unresolved { uncertainty } => formatter
44                .debug_struct("Unresolved")
45                .field("uncertainty", uncertainty)
46                .finish(),
47        }
48    }
49}
50
51/// Passive claims bound to original reservations and independently retained inventories.
52///
53/// Integrations retain the full original baseline before capture and authenticate
54/// actual context/target, chronology, freshness, permissions, custody and attribution.
55/// `evidence` binds all fields and their qualification. No persisted proof flag,
56/// spending owner or receipt is introduced.
57#[derive(Clone, Debug)]
58pub struct IcCaptureSettlement {
59    /// Complete original plan/operation/immutable allowance digest.
60    pub authority: ArtifactChecksumRecord,
61    /// Exact original pending capture attempt.
62    pub mutation_attempt: u32,
63    /// Exact already consumed pending list observation attempt.
64    pub observation_attempt: u32,
65    /// Current caller-owned qualification challenge, never a spending allowance.
66    pub challenge: ArtifactChecksumRecord,
67    /// Existing exact original list request/raw baseline digest.
68    pub baseline: ArtifactChecksumRecord,
69    /// Existing exact current list request/raw inventory digest.
70    pub inventory: ArtifactChecksumRecord,
71    /// Exact opaque evidence retained with the passive list response.
72    pub observation_evidence: ArtifactChecksumRecord,
73    /// Independently qualified outcome, never inferred from candidate count.
74    pub attribution: IcCaptureAttribution,
75    /// Complete retained integration qualification evidence.
76    pub evidence: ArtifactChecksumRecord,
77}