ic_backup/ports/membership/mod.rs
1//! Current membership integration contract; no default provider or backend implementation.
2
3use crate::model::membership::{MembershipObservation, MembershipObservationRequest};
4use thiserror::Error;
5
6/// Integration-owned authoritative membership observation, separate from control/read authority.
7///
8/// Implementations resolve the locked authenticated context, perform fresh bounded
9/// observations and report their exact context and full inventory. They own challenge
10/// freshness, revision/evidence meaning, per-call prior accounting, lost-response
11/// retention and coherent custody. A request ceiling never grants spending authority.
12/// Returning an echoed declaration or decoded old receipt is not an observation.
13/// Matching before/after observations cannot certify continuity or an application fence.
14/// No provider is installed by the library; an absent provider must fail unavailable.
15pub trait MembershipProvider {
16 /// Obtain a current result under the exact original request and descriptive call bound.
17 ///
18 /// # Errors
19 /// Unavailable/unsupported reject before remote effects. An indeterminate outcome
20 /// retains any consumed allowance and does not authorize retry or mutation.
21 fn observe_membership(
22 &mut self,
23 request: &MembershipObservationRequest<'_>,
24 ) -> Result<MembershipObservation, MembershipProviderError>;
25}
26
27/// Redacted typed provider failure; none implies an accepted membership result.
28#[derive(Clone, Copy, Debug, Eq, Error, PartialEq)]
29pub enum MembershipProviderError {
30 /// A required qualified provider is absent; no remote effects occurred.
31 #[error("membership provider unavailable")]
32 Unavailable,
33 /// Provider cannot meet the requested contract; reject before remote effects.
34 #[error("membership observation contract unsupported")]
35 Unsupported,
36 /// Observation failed or reply/accounting is uncertain; retain evidence and stop.
37 #[error("membership observation indeterminate")]
38 Indeterminate,
39}