Skip to main content

euv_core/dynamic/state/
enum.rs

1use super::*;
2
3/// Outcome returned by the host-owned `BusinessStateStore` when handling a typed command.
4#[derive(Clone, Debug, PartialEq)]
5pub enum CommandOutcome {
6    /// Command committed atomically at `revision` (or replayed via idempotency key).
7    Committed {
8        /// Stable operation identifier assigned by the host.
9        operation_id: OperationId,
10        /// Target business entity identifier.
11        entity_id: String,
12        /// Committed entity revision number.
13        revision: u64,
14        /// Authoritative post-commit entity state.
15        state: Value,
16        /// `true` when this result was returned from idempotency deduplication.
17        deduplicated: bool,
18    },
19    /// Command accepted into host-owned in-flight execution and guaranteed to finish across hot-swaps.
20    Pending {
21        /// Stable operation identifier assigned by the host.
22        operation_id: OperationId,
23        /// Target business entity identifier.
24        entity_id: String,
25        /// Entity revision observed when the command was accepted.
26        submitted_revision: u64,
27    },
28    /// Command rejected because `expected_revision` did not match the live authoritative revision.
29    RejectedRevisionConflict {
30        /// Stable operation identifier assigned by the host.
31        operation_id: OperationId,
32        /// Revision expected by the caller.
33        expected: u64,
34        /// Live authoritative revision stored by the host.
35        actual: u64,
36    },
37    /// Command rejected due to validation or host business rule failure.
38    RejectedError {
39        /// Stable operation identifier assigned by the host.
40        operation_id: OperationId,
41        /// Diagnostic failure description.
42        reason: String,
43    },
44}