Skip to main content

BackgroundScheduler

Struct BackgroundScheduler 

Source
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

Source

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.

Source

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).

Source

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.

Source

pub fn submitter(&self) -> Submitter

Get a submitter handle (cheap clone-friendly).

Source

pub fn collector(&self) -> ResultCollector

Get a result collector handle.

Source

pub fn heartbeat(&self) -> Arc<HeartbeatTable>

Access the heartbeat table for failover-watchdog usage.

Source

pub fn slot_idx(&self) -> usize

The slot index this scheduler claimed in the heartbeat table.

Source

pub fn watchdog_scan(&self) -> ReclaimReport

One scan of the watchdog (typically called from the coordinator process’s main loop). Returns reclaim report.

Trait Implementations§

Source§

impl AdaptiveInstance for BackgroundScheduler

Source§

fn header(&self) -> &HandshakeHeader

Source§

fn ring(&self) -> &ObservationRing

Source§

fn make_policy(&self) -> Box<dyn Policy>

Source§

fn apply_migration(&self, new_tag: u32)

Called by the sidecar when the policy returns a new strategy tag. Default implementation: just set the tag on the header. Primitives that need heavier migration (data-layout swap) override this to perform the swap before (or after) updating the tag.
Source§

impl Drop for BackgroundScheduler

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.