Skip to main content

backbone_bucket/domain/state_machine/
mod.rs

1mod bucket_state_machine;
2mod conversion_job_state_machine;
3mod file_comment_state_machine;
4mod file_lock_state_machine;
5mod file_share_state_machine;
6mod processing_job_state_machine;
7mod stored_file_state_machine;
8mod upload_session_state_machine;
9mod user_quota_state_machine;
10
11/// Shared error type for all state machines in this module
12#[derive(Debug, Clone, thiserror::Error)]
13pub enum StateMachineError {
14    #[error("Invalid state: {0}")]
15    InvalidState(String),
16
17    #[error("Invalid transition: {0}")]
18    InvalidTransition(String),
19
20    #[error("Transition '{transition}' not allowed from state '{from}'")]
21    TransitionNotAllowed {
22        transition: String,
23        from: String,
24    },
25
26    #[error("Role '{role}' not authorized for transition '{transition}'")]
27    RoleNotAuthorized {
28        role: String,
29        transition: String,
30    },
31
32    #[error("Guard condition failed for transition '{0}'")]
33    GuardFailed(String),
34
35    #[error("Cannot transition from final state '{0}'")]
36    FinalStateReached(String),
37}
38
39pub use bucket_state_machine::{BucketState, BucketTransition, BucketStateMachine};
40pub use conversion_job_state_machine::{ConversionJobState, ConversionJobTransition, ConversionJobStateMachine};
41pub use file_comment_state_machine::{FileCommentState, FileCommentTransition, FileCommentStateMachine};
42pub use file_lock_state_machine::{FileLockState, FileLockTransition, FileLockStateMachine};
43pub use file_share_state_machine::{FileShareState, FileShareTransition, FileShareStateMachine};
44pub use processing_job_state_machine::{ProcessingJobState, ProcessingJobTransition, ProcessingJobStateMachine};
45pub use stored_file_state_machine::{StoredFileState, StoredFileTransition, StoredFileStateMachine};
46pub use upload_session_state_machine::{UploadSessionState, UploadSessionTransition, UploadSessionStateMachine};
47pub use user_quota_state_machine::{UserQuotaState, UserQuotaTransition, UserQuotaStateMachine};