Skip to main content

trine_kv/content/reclaim/
quarantine.rs

1use super::{
2    ContentAccessBarrierId, ContentId, ContentReaderDrainAttestationId, ContentReclaimProofToken,
3    StorageDomainId,
4};
5
6/// Durable, exact-content quarantine coordinate.
7///
8/// The record binds one accepted reclaim intent, the leased-only barrier, and
9/// the trusted reader-drain attestation used by the transition. Quarantine
10/// prevents new leased opens but retains the descriptor and all content bytes.
11/// Attachment authority or a physical hold may atomically return the content to
12/// Active state before any future deletion protocol begins.
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub struct ContentQuarantine {
15    pub(in crate::content::reclaim) storage_domain_id: StorageDomainId,
16    pub(in crate::content::reclaim) content_id: ContentId,
17    pub(in crate::content::reclaim) proof_token: ContentReclaimProofToken,
18    pub(in crate::content::reclaim) verified_at: crate::ReadVersion,
19    pub(in crate::content::reclaim) proof_expires_at_unix_ms: u64,
20    pub(in crate::content::reclaim) intent_accepted_at: crate::ReadVersion,
21    pub(in crate::content::reclaim) barrier_id: ContentAccessBarrierId,
22    pub(in crate::content::reclaim) barrier_enforced_at: crate::ReadVersion,
23    pub(in crate::content::reclaim) drain_attestation_id: ContentReaderDrainAttestationId,
24    pub(in crate::content::reclaim) quarantined_at: crate::ReadVersion,
25}
26
27impl ContentQuarantine {
28    /// Returns the physical lifecycle domain.
29    #[must_use]
30    pub const fn storage_domain_id(self) -> StorageDomainId {
31        self.storage_domain_id
32    }
33
34    /// Returns the exact immutable content identity.
35    #[must_use]
36    pub const fn content_id(self) -> ContentId {
37        self.content_id
38    }
39
40    /// Returns the opaque higher-layer proof token accepted by the intent.
41    #[must_use]
42    pub const fn proof_token(self) -> ContentReclaimProofToken {
43        self.proof_token
44    }
45
46    /// Returns the logical proof's stable verification coordinate.
47    #[must_use]
48    pub const fn verified_at(self) -> crate::ReadVersion {
49        self.verified_at
50    }
51
52    /// Returns the logical proof's exclusive Unix-millisecond deadline.
53    ///
54    /// Expiry does not remove an already durable quarantine. A future sweep
55    /// still needs a fresh logical proof and all physical checks.
56    #[must_use]
57    pub const fn proof_expires_at_unix_ms(self) -> u64 {
58        self.proof_expires_at_unix_ms
59    }
60
61    /// Returns the commit sequence that accepted the matching reclaim intent.
62    #[must_use]
63    pub const fn intent_accepted_at(self) -> crate::ReadVersion {
64        self.intent_accepted_at
65    }
66
67    /// Returns the irreversible leased-only barrier identity.
68    #[must_use]
69    pub const fn barrier_id(self) -> ContentAccessBarrierId {
70        self.barrier_id
71    }
72
73    /// Returns the commit sequence that completed the leased-only barrier.
74    #[must_use]
75    pub const fn barrier_enforced_at(self) -> crate::ReadVersion {
76        self.barrier_enforced_at
77    }
78
79    /// Returns the trusted coordinator attestation bound to the transition.
80    #[must_use]
81    pub const fn drain_attestation_id(self) -> ContentReaderDrainAttestationId {
82        self.drain_attestation_id
83    }
84
85    /// Returns the commit sequence that established quarantine.
86    #[must_use]
87    pub const fn quarantined_at(self) -> crate::ReadVersion {
88        self.quarantined_at
89    }
90}