sim-lib-operation-gate 0.4.0

Domain-neutral capability and exact-approval gate for effectful SIM operations.
Documentation
use sim_lib_journal::JournalError;
use thiserror::Error;

/// Typed refusal from durable operation construction, replay, or publication.
#[derive(Debug, Error)]
pub enum OperationError {
    /// An operation name cannot be empty.
    #[error("operation name is empty")]
    EmptyOperation,
    /// A supplied value was not the canonical value claimed by its identity.
    #[error("noncanonical {0}")]
    NonCanonical(&'static str),
    /// The same claimed operation identity carried different intent.
    #[error("contradictory intent under one operation id")]
    ContradictoryIntent,
    /// A grant did not belong to the stable operation.
    #[error("operation grant does not match intent")]
    GrantMismatch,
    /// An attempt did not belong to the stable operation.
    #[error("operation attempt does not match intent")]
    AttemptMismatch,
    /// A bounded operation lease was empty, expired at acquisition, or moved backwards.
    #[error("invalid bounded operation lease")]
    InvalidLease,
    /// The postcondition observer was the same authority as the performer.
    #[error("postcondition observer is not independent of the performer")]
    ObserverNotIndependent,
    /// Recovery selected a different performer authority for the same operation.
    #[error("operation performer does not match the durable dispatch authority")]
    PerformerMismatch,
    /// Durable replay contained a second intent for one operation.
    #[error("durable operation contains duplicate intent")]
    DuplicateIntent,
    /// A durable event violated the operation state order.
    #[error("invalid durable operation transition: {0}")]
    InvalidTransition(&'static str),
    /// The service has no live fenced writer lease.
    #[error("operation service must be explicitly resumed")]
    NotResumed,
    /// The journal sequence cannot be extended.
    #[error("operation journal sequence is exhausted")]
    SequenceExhausted,
    /// The underlying canonical journal refused the operation.
    #[error(transparent)]
    Journal(#[from] JournalError),
}