Skip to main content

Sequencer

Struct Sequencer 

Source
pub struct Sequencer { /* private fields */ }
Expand description

Owns the single writer thread; the only component allowed to append to the repo’s OpLog.

Implementations§

Source§

impl Sequencer

Source

pub fn spawn(log: Box<dyn OpLog>) -> Self

Starts the writer thread over log with the AdmitAll policy.

Source

pub fn spawn_with_policy( log: Box<dyn OpLog>, policy: Box<dyn SubmitPolicy>, ) -> Self

Starts the writer thread over log; every submission passes through policy before it is ordered.

Records nothing. Use Sequencer::spawn_with_journal to observe decisions.

Source

pub fn spawn_with_journal( log: Box<dyn OpLog>, policy: Box<dyn SubmitPolicy>, journal: Box<dyn Journal>, ) -> Self

Sequencer::spawn_with_policy, recording every decision to journal.

The journal is derived data: it is written after the decision is made, never consulted, and its failure cannot refuse an op. See journal for why the I/O belongs on another thread.

Source

pub fn lag(&self) -> Arc<LagMeter>

The writer’s latency record, for a daemon that wants to know whether the decision-latency gate is being met by the traffic it is actually serving rather than by the test suite.

Source

pub fn handle(&self) -> SequencerHandle

Creates a new client handle for a workspace.

Source

pub fn shutdown(self) -> Box<dyn OpLog>

Stops the writer thread and returns the log for inspection.

§Panics

Panics if the writer thread itself panicked.

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.