Skip to main content

actionqueue_core/task/
safety.rs

1//! Safety level classification for task execution.
2
3/// Classification of a task's side-effect safety characteristics.
4///
5/// This classification informs the engine about the safety guarantees
6/// of a task's handler, enabling appropriate retry and scheduling decisions.
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9pub enum SafetyLevel {
10    /// The task produces no side effects. Safe to retry unconditionally.
11    #[default]
12    Pure,
13    /// The task may produce side effects but is safe to retry
14    /// (applying the same operation multiple times has the same effect as once).
15    Idempotent,
16    /// The task produces non-idempotent side effects. Retrying may cause
17    /// duplicate effects. Use with caution.
18    Transactional,
19}