coven_replication/sync/store/owner_role_promotion/
error.rs1use crate::sync::store::StoreError;
2use coven_protocol::objects::StorageError;
3use coven_protocol::store_commit::{OwnerPromotionId, OwnerPromotionStaleReason};
4
5#[derive(Debug, thiserror::Error)]
6pub enum OwnerPromotionError {
7 #[error("Owner promotion database state: {0}")]
8 Database(#[from] coven_database::DbError),
9 #[error("Owner promotion protocol state: {0}")]
10 Protocol(String),
11 #[error("Owner promotion storage: {0}")]
12 Storage(#[from] StorageError),
13 #[error("Owner promotion Store operation: {0}")]
14 Store(#[source] Box<StoreError>),
15 #[error("Owner promotion writer authorization: {0}")]
16 WriterAuthorization(#[source] Box<crate::sync::store::StoreWriterAuthorizationError>),
17 #[error("Owner promotion Store pull: {0}")]
18 StorePull(#[source] Box<crate::sync::store::StorePullError>),
19 #[error("Owner promotion membership operation: {0}")]
20 MembershipMutation(#[source] Box<crate::sync::store::MembershipMutationError>),
21 #[error("Owner promotion membership chain: {0}")]
22 AnchoredChain(#[source] Box<crate::sync::store::AnchoredChainError>),
23 #[error("Owner promotion Store object: {0}")]
24 StoreObject(#[from] coven_protocol::objects::StoreObjectError),
25 #[error("Owner promotion prepared commit: {0}")]
26 PreparedCommit(#[from] coven_protocol::prepared_commit::PreparedCommitError),
27 #[error("Owner promotion membership preparation: {0}")]
28 MembershipPreparation(#[from] coven_protocol::membership_mutation::MembershipPreparationError),
29 #[error("Owner promotion journal: {0}")]
30 Journal(#[from] coven_protocol::owner_promotion_journal::OwnerPromotionJournalError),
31 #[error("Owner promotion Store protocol: {0}")]
32 StoreProtocol(#[from] coven_protocol::store_commit::StoreProtocolError),
33 #[error("Owner promotion membership protocol: {0}")]
34 Membership(#[from] coven_protocol::membership::MembershipError),
35 #[error("Owner promotion key: {0}")]
36 Key(#[from] coven_keys::keys::KeyError),
37 #[error("Owner promotion encryption: {0}")]
38 Encryption(#[from] coven_keys::encryption::EncryptionError),
39 #[error("Owner promotion request has not activated")]
40 RequestNotActivated,
41 #[error("Owner promotion requires an encrypted cloud home")]
42 EncryptionRequired,
43 #[error("Owner promotion {0} is absent")]
44 NotFound(OwnerPromotionId),
45 #[error("Owner promotion is stale: {0:?}")]
46 Stale(Box<OwnerPromotionStaleReason>),
47}
48
49impl From<StoreError> for OwnerPromotionError {
50 fn from(error: StoreError) -> Self {
51 Self::Store(Box::new(error))
52 }
53}
54
55impl From<crate::sync::store::StoreWriterAuthorizationError> for OwnerPromotionError {
56 fn from(error: crate::sync::store::StoreWriterAuthorizationError) -> Self {
57 Self::WriterAuthorization(Box::new(error))
58 }
59}
60
61impl From<crate::sync::store::StorePullError> for OwnerPromotionError {
62 fn from(error: crate::sync::store::StorePullError) -> Self {
63 Self::StorePull(Box::new(error))
64 }
65}
66
67impl From<crate::sync::store::MembershipMutationError> for OwnerPromotionError {
68 fn from(error: crate::sync::store::MembershipMutationError) -> Self {
69 Self::MembershipMutation(Box::new(error))
70 }
71}
72
73impl From<crate::sync::store::AnchoredChainError> for OwnerPromotionError {
74 fn from(error: crate::sync::store::AnchoredChainError) -> Self {
75 Self::AnchoredChain(Box::new(error))
76 }
77}