Skip to main content

MutationProjection

Trait MutationProjection 

Source
pub trait MutationProjection {
    type Error;

    // Required methods
    fn latest_sequence(&self) -> u64;
    fn run_state(&self, run_id: &RunId) -> Option<RunState>;
    fn task_exists(&self, task_id: TaskId) -> bool;
    fn is_task_canceled(&self, task_id: TaskId) -> bool;
    fn is_engine_paused(&self) -> bool;
    fn active_attempt_id(&self, run_id: &RunId) -> Option<AttemptId>;
    fn active_lease(&self, run_id: &RunId) -> Option<(String, u64)>;
    fn apply_event(&mut self, event: &WalEvent) -> Result<(), Self::Error>;

    // Provided methods
    fn budget_allocation_exists(
        &self,
        _task_id: TaskId,
        _dimension: BudgetDimension,
    ) -> bool { ... }
    fn subscription_exists(&self, _subscription_id: SubscriptionId) -> bool { ... }
    fn is_subscription_canceled(&self, _subscription_id: SubscriptionId) -> bool { ... }
}
Expand description

Projection behavior required by the mutation authority.

Required Associated Types§

Source

type Error

Typed projection apply error.

Required Methods§

Source

fn latest_sequence(&self) -> u64

Returns the latest durable sequence represented by this projection.

Source

fn run_state(&self, run_id: &RunId) -> Option<RunState>

Returns the current run state for validation, if known.

Source

fn task_exists(&self, task_id: TaskId) -> bool

Returns true when the task exists in current projection state.

Source

fn is_task_canceled(&self, task_id: TaskId) -> bool

Returns true when the task is already marked canceled in projection state.

Source

fn is_engine_paused(&self) -> bool

Returns true when engine control projection is currently paused.

Source

fn active_attempt_id(&self, run_id: &RunId) -> Option<AttemptId>

Returns the active attempt identifier for the run, if one exists.

Source

fn active_lease(&self, run_id: &RunId) -> Option<(String, u64)>

Returns the active lease metadata (owner, expiry) for the run, if one exists.

Source

fn apply_event(&mut self, event: &WalEvent) -> Result<(), Self::Error>

Applies a durable event to the in-memory projection.

Provided Methods§

Source

fn budget_allocation_exists( &self, _task_id: TaskId, _dimension: BudgetDimension, ) -> bool

Returns true when a budget allocation exists for the specified (task, dimension) pair.

Source

fn subscription_exists(&self, _subscription_id: SubscriptionId) -> bool

Returns true when the specified subscription exists in the projection.

Source

fn is_subscription_canceled(&self, _subscription_id: SubscriptionId) -> bool

Returns true when the specified subscription has been canceled.

Implementors§