Skip to main content

DeterminismController

Trait DeterminismController 

Source
pub trait DeterminismController: Send + Sync {
    // Required methods
    fn partition(
        &self,
        ready: &[PendingActivation],
        region: Region,
        now: SchedTime,
    ) -> Vec<WorkItem>;
    fn on_read(&self, act: ActivationId, cell: StateCellId, version: u64);
    fn on_write(
        &self,
        act: ActivationId,
        cell: StateCellId,
        prior: FourStateValue,
        version: u64,
    );
    fn gvt(&self) -> SchedTime;
    fn drain_and_resolve(&self, work: Vec<WorkItem>) -> ResolvedBatch;
    fn kind(&self) -> &'static str;
}
Expand description

A pluggable rollback/ordering mechanism (scheduler.md §6; ledger SC-008, SC-009, SC-013, SC-030, SC-074, SC-076). v1 ships a degenerate sequential controller (gvt() == now always, no rollback) as its own test oracle; WOCB plugs in here per-region once each region’s own cross-thread-count fuzz harness is green (ARCHITECTURE §4).

Required Methods§

Source

fn partition( &self, ready: &[PendingActivation], region: Region, now: SchedTime, ) -> Vec<WorkItem>

Source

fn on_read(&self, act: ActivationId, cell: StateCellId, version: u64)

act is the ActivationId of the WorkItem (partition()’s own output, WorkItem.activation.id) currently executing the read/write.

Source

fn on_write( &self, act: ActivationId, cell: StateCellId, prior: FourStateValue, version: u64, )

Source

fn gvt(&self) -> SchedTime

The commit horizon: nothing at/after this may be observed externally.

Source

fn drain_and_resolve(&self, work: Vec<WorkItem>) -> ResolvedBatch

Source

fn kind(&self) -> &'static str

NEW (Task 18, wA-sched plan, SC-083’s Engine::controller_kind testability getter — see sched::control’s deviations note). A short, stable, human-readable tag identifying the concrete controller implementation, with no other production use (never parsed, never part of any ordering/commit decision) — added purely so Engine::controller_kind() can prove, from outside, which concrete Box<dyn DeterminismController> is currently installed (the default SequentialController vs. a caller-supplied override), without this crate resorting to Any/downcasting for a testability-only need. determinism is owned by the same sched track as Task 18 (docs/CONTRACTS.md), so this is an in-track, additive trait extension, not a foreign-contract change.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§