Skip to main content

Driver

Struct Driver 

Source
pub struct Driver<R, E> { /* private fields */ }
Expand description

Mechanical loop that performs the directives the sans-I/O kernel issues.

This is a reference runtime skeleton. It drives one step synchronously — claim, execute, settle — and never heartbeats or reclaims within a step: it does not extend a lease while its executor runs (so a long-running pact’s lease can expire mid-step), and it settles by matching the retainer rather than re-claiming. It is therefore safe for pacts shorter than the lease (the lease never expires mid-step) and for single-worker use (no concurrent claimer can reclaim an expired lease mid-step). A workload that is both long-running and multi-worker should compose its own loop over the Registry contract (which includes heartbeat); the lifecycle kernel deliberately models no in-flight heartbeat.

Implementations§

Source§

impl<R, E> Driver<R, E>

Source

pub fn new( registry: R, executor: E, dockets: impl IntoIterator<Item = String>, ) -> Self

Build a driver from a registry, an executor, and docket names.

Source

pub fn registry(&self) -> &R

Borrow the registry used by this driver.

Source

pub fn executor(&self) -> &E

Borrow the executor used by this driver.

Source§

impl<R, E> Driver<R, E>
where R: Registry, E: Executor,

Source

pub fn step(&mut self) -> Result<Step, DriverError<R::Error, E::Error>>

Perform one claim, execute, and settle step by driving the kernel: the kernel decides each directive; the driver performs it and feeds a notice back, deciding no lifecycle outcome itself.

Auto Trait Implementations§

§

impl<R, E> Freeze for Driver<R, E>
where R: Freeze, E: Freeze,

§

impl<R, E> RefUnwindSafe for Driver<R, E>

§

impl<R, E> Send for Driver<R, E>
where R: Send, E: Send,

§

impl<R, E> Sync for Driver<R, E>
where R: Sync, E: Sync,

§

impl<R, E> Unpin for Driver<R, E>
where R: Unpin, E: Unpin,

§

impl<R, E> UnsafeUnpin for Driver<R, E>
where R: UnsafeUnpin, E: UnsafeUnpin,

§

impl<R, E> UnwindSafe for Driver<R, E>
where R: UnwindSafe, E: UnwindSafe,

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.