pub struct BackgroundScheduler { /* private fields */ }Expand description
The autonomous executor running in this process.
Submit and result transports are abstracted behind
MessageTransport so the scheduler can ride either the
canonical MPMC SharedRing or the SPMC
SharedDeque<PassSlot> work-stealing transport. The constructor
picks per workload topology.
Implementations§
Source§impl BackgroundScheduler
impl BackgroundScheduler
Sourcepub fn start(
submit_path: impl AsRef<Path>,
result_path: impl AsRef<Path>,
heartbeat_path: impl AsRef<Path>,
capacity: usize,
heartbeat_capacity: usize,
) -> Result<Self, SchedError>
pub fn start( submit_path: impl AsRef<Path>, result_path: impl AsRef<Path>, heartbeat_path: impl AsRef<Path>, capacity: usize, heartbeat_capacity: usize, ) -> Result<Self, SchedError>
Create a new scheduler. Opens the submit + result rings and the heartbeat table; registers this process; spawns the worker thread that drains the submit ring.
Sourcepub fn start_with_transports(
submit_ring: Arc<dyn MessageTransport>,
result_ring: Arc<dyn MessageTransport>,
heartbeat_path: impl AsRef<Path>,
heartbeat_capacity: usize,
) -> Result<Self, SchedError>
pub fn start_with_transports( submit_ring: Arc<dyn MessageTransport>, result_ring: Arc<dyn MessageTransport>, heartbeat_path: impl AsRef<Path>, heartbeat_capacity: usize, ) -> Result<Self, SchedError>
Construct a scheduler from caller-supplied transports.
Lets the caller pick the wire-format primitive at the
transport layer (canonical SharedRing MPMC, SPMC
SharedDeque<PassSlot>, or any other future
MessageTransport impl).
Sourcepub fn start_by_workload_shape(
submit_path: impl AsRef<Path>,
submit_shape: MmfWorkloadShape,
result_path: impl AsRef<Path>,
result_shape: MmfWorkloadShape,
heartbeat_path: impl AsRef<Path>,
capacity: usize,
heartbeat_capacity: usize,
) -> Result<(Self, MmfFamily, MmfFamily), SchedError>
pub fn start_by_workload_shape( submit_path: impl AsRef<Path>, submit_shape: MmfWorkloadShape, result_path: impl AsRef<Path>, result_shape: MmfWorkloadShape, heartbeat_path: impl AsRef<Path>, capacity: usize, heartbeat_capacity: usize, ) -> Result<(Self, MmfFamily, MmfFamily), SchedError>
Construct a scheduler with transports picked by
MmfDispatcher from caller-supplied
workload shapes. The submit-side and result-side shapes can
differ (the canonical pair is StreamingMpmc for submit and
WorkStealing(producer_fast(K)) for result). Returns the
scheduler plus the picked families so the caller can confirm
the routing decision matched expectations.
SharedRing and SharedDeque<PassSlot> are the two
supported transport families;
MmfFamily::SharedHashMap
is rejected with
SchedError::UnsupportedTransportFamily because the
scheduler’s wire format is push / pop, not key / value.
Sourcepub fn collector(&self) -> ResultCollector
pub fn collector(&self) -> ResultCollector
Get a result collector handle.
Sourcepub fn heartbeat(&self) -> Arc<HeartbeatTable> ⓘ
pub fn heartbeat(&self) -> Arc<HeartbeatTable> ⓘ
Access the heartbeat table for failover-watchdog usage.
Sourcepub fn watchdog_scan(&self) -> ReclaimReport
pub fn watchdog_scan(&self) -> ReclaimReport
One scan of the watchdog (typically called from the coordinator process’s main loop). Returns reclaim report.