Skip to main content

BrowserRuntime

Struct BrowserRuntime 

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

Deterministic authority lifecycle and session clock.

This type is deliberately neither Clone nor Copy: duplicating it would fork the monotonic event clock for one session.

Implementations§

Source§

impl BrowserRuntime

Source

pub const fn new(session: RuntimeSessionId) -> Self

Start a fresh runtime session at generation one.

Source

pub const fn snapshot(&self) -> RuntimeSnapshot

Read the complete immutable status.

Source

pub const fn authority_state(&self) -> AuthorityState

Current authority state.

Source

pub const fn ensure_policy_change_capacity(&self) -> Result<(), RuntimeError>

Whether policy revocation can advance both monotonic counters.

§Errors

Returns RuntimeError::CounterExhausted if either counter is at its maximum value.

Source

pub fn policy_changed(&mut self) -> Result<RuntimeSnapshot, RuntimeError>

Revoke prior work after a committed policy change.

§Errors

Returns RuntimeError::CounterExhausted if the generation or event sequence cannot advance.

Source

pub fn transition( &mut self, next: AuthorityState, ) -> Result<RuntimeSnapshot, RuntimeError>

Advance the exact browser authority state machine.

§Errors

Returns RuntimeError::InvalidAuthorityTransition for an edge outside the required state graph, or RuntimeError::CounterExhausted if the event sequence cannot advance.

Source

pub fn admit_event(&mut self) -> Result<RuntimeStamp, RuntimeError>

Record an admitted operation and bind it to this session/generation.

§Errors

Returns RuntimeError::AuthorityNotReady before transport readiness, RuntimeError::Stopped after terminal shutdown, or RuntimeError::CounterExhausted if the event sequence cannot advance.

Source

pub fn admits(&self, stamp: RuntimeStamp) -> bool

Check that a stamp belongs to current, already-admitted work.

Trait Implementations§

Source§

impl Debug for BrowserRuntime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for BrowserRuntime

Source§

impl PartialEq for BrowserRuntime

Source§

fn eq(&self, other: &BrowserRuntime) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BrowserRuntime

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.