Skip to main content

StartupEvents

Struct StartupEvents 

Source
pub struct StartupEvents<E> {
    pub genesis: Vec<E>,
    pub on_primary: Vec<E>,
}
Expand description

Events the runtime journals as a node takes up the primary role, before it serves its first client.

They go through the journal like any client event, and that is the point: replicas receive them in the stream, and every replay — from genesis, from a snapshot, on a promoted replica — applies them again, in order. Nothing the application’s state depends on bypasses the journal, so recovery can only reproduce the state the node had.

Vec rather than an iterator: both sets are built once at startup from operator configuration and consumed once, off any hot path.

Fields§

§genesis: Vec<E>

The first events of the history: what every node’s state starts from (instruments, accounts, …). Journaled once, by the node that creates the journal as primary. A node that recovers an existing journal, or follows a primary, already has them in its history.

§on_primary: Vec<E>

Journaled every time a node becomes primary — after genesis on a new journal, on recovering an existing journal as primary, and right after the epoch bump on promotion.

Operator configuration the application enforces (rate limits, caps) belongs here. The values in force are then always those of the node serving clients, recorded in the history they govern: replicas apply the primary’s values, not their own, and replay makes the decisions the values made the first time. A node’s own values take effect only once it is primary. Re-applying a value already in force should leave the state unchanged.

Implementations§

Source§

impl<E> StartupEvents<E>

Source

pub fn none() -> Self

No startup events: an application whose history starts empty and which takes no operator configuration.

Auto Trait Implementations§

§

impl<E> Freeze for StartupEvents<E>
where Vec<E>: Freeze,

§

impl<E> RefUnwindSafe for StartupEvents<E>
where Vec<E>: RefUnwindSafe,

§

impl<E> Send for StartupEvents<E>
where Vec<E>: Send,

§

impl<E> Sync for StartupEvents<E>
where Vec<E>: Sync,

§

impl<E> Unpin for StartupEvents<E>
where Vec<E>: Unpin,

§

impl<E> UnsafeUnpin for StartupEvents<E>
where Vec<E>: UnsafeUnpin,

§

impl<E> UnwindSafe for StartupEvents<E>
where Vec<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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> OptionalSend for T
where T: Send + ?Sized,

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more