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§
Required Methods§
Sourcefn latest_sequence(&self) -> u64
fn latest_sequence(&self) -> u64
Returns the latest durable sequence represented by this projection.
Sourcefn run_state(&self, run_id: &RunId) -> Option<RunState>
fn run_state(&self, run_id: &RunId) -> Option<RunState>
Returns the current run state for validation, if known.
Sourcefn task_exists(&self, task_id: TaskId) -> bool
fn task_exists(&self, task_id: TaskId) -> bool
Returns true when the task exists in current projection state.
Sourcefn is_task_canceled(&self, task_id: TaskId) -> bool
fn is_task_canceled(&self, task_id: TaskId) -> bool
Returns true when the task is already marked canceled in projection state.
Sourcefn is_engine_paused(&self) -> bool
fn is_engine_paused(&self) -> bool
Returns true when engine control projection is currently paused.
Sourcefn active_attempt_id(&self, run_id: &RunId) -> Option<AttemptId>
fn active_attempt_id(&self, run_id: &RunId) -> Option<AttemptId>
Returns the active attempt identifier for the run, if one exists.
Provided Methods§
Sourcefn budget_allocation_exists(
&self,
_task_id: TaskId,
_dimension: BudgetDimension,
) -> bool
fn budget_allocation_exists( &self, _task_id: TaskId, _dimension: BudgetDimension, ) -> bool
Returns true when a budget allocation exists for the specified (task, dimension) pair.
Sourcefn subscription_exists(&self, _subscription_id: SubscriptionId) -> bool
fn subscription_exists(&self, _subscription_id: SubscriptionId) -> bool
Returns true when the specified subscription exists in the projection.
Sourcefn is_subscription_canceled(&self, _subscription_id: SubscriptionId) -> bool
fn is_subscription_canceled(&self, _subscription_id: SubscriptionId) -> bool
Returns true when the specified subscription has been canceled.