Skip to main content

SessionFoldView

Struct SessionFoldView 

Source
pub struct SessionFoldView<'a> { /* private fields */ }
Expand description

One Session’s fold, read one value at a time.

Each getter takes the fold’s lock briefly and returns an owned copy of one value, so an event waits at most for one getter’s copy, never for caller code, and no event copies the whole fold. No read spans several values atomically: an event can land between two calls.

Implementations§

Source§

impl SessionFoldView<'_>

Source

pub fn item(&self, id: &str) -> Option<Value>

Item id at its latest revision, with the deltas since that revision appended, or None when the fold holds no such item.

Source

pub fn item_count(&self) -> usize

How many items the fold holds; items are never removed.

Source

pub fn item_ids(&self) -> Vec<String>

Item ids in first-seen order (resume history first, in served order).

Source

pub fn accumulated(&self, id: &str, field: &str) -> Option<String>

The item/delta text appended to item id’s field since its latest revision arrived, or None when none has.

Source

pub fn session_state(&self, family: &str) -> Option<Value>

The latest params of the session-state notification family (for example session/modelChanged), or None when the fold applied none.

Source

pub fn active_turn_id(&self) -> Option<String>

The turn whose turn/started the fold applied last, until that turn completes, is retracted or is unqueued. On a resumed session the turn running at resume shows here only if the resume’s streamed events replay its turn/started; Session::opening names that turn in session.activeTurnId, but if its lastTurn names the same turn, that turn has ended.

Source

pub fn turn(&self, id: &str) -> Option<Turn>

The fold’s record of turn id, or None when no turn event the fold applied named it (a declined turn/retracted for a turn it has not seen adds none).

Source

pub fn turn_ids(&self) -> Vec<String>

Turn ids in first-seen order.

Source

pub fn pending_gap(&self) -> Option<DeliveryGap>

The delivery gap the fold has pending, or None. A stopped fold keeps its last gap, which nothing fills (see Self::is_stopped).

Source

pub fn is_current(&self) -> bool

False while a delivery gap is pending, and for good once the session lost an event or its id was opened again on the same client.

Source

pub fn is_stopped(&self) -> bool

True for good once the fold stopped applying events: the session lost an event (nothing applies after), or its id was opened again on the same client (only question events still apply, until its event source fails). A stopped fold can keep the gap it had pending, so this, not Self::is_current, tells it apart from a fill still running.

Source

pub fn pending_approval(&self, id: &str) -> Option<Value>

The params of the latest approval/requested or approval/updated for approval id, while it awaits its first terminal.

Source

pub fn resolved_approval(&self, id: &str) -> Option<Value>

The first approval/resolved params of approval id; a later terminal never replaces it.

Source

pub fn pending_approvals(&self) -> Vec<PendingApproval>

Pending approvals in first-request order, each with its latest request and latest update.

Source

pub fn resolved_approvals(&self) -> Vec<Value>

The first durable terminal per approval, in first-resolution order.

Source

pub fn pending_user_input(&self, id: &str) -> Option<Value>

The latest userInput/requested params of question id while it awaits its first settlement.

Source

pub fn settled_user_input(&self, id: &str) -> Option<Value>

The first userInput/settled params of question id; a later settlement never replaces it.

Source

pub fn pending_user_inputs(&self) -> Vec<Value>

Pending user-input requests in first-request order.

Source

pub fn settled_user_inputs(&self) -> Vec<Value>

Settled user-input requests in first-settlement order.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for SessionFoldView<'a>

§

impl<'a> !UnwindSafe for SessionFoldView<'a>

§

impl<'a> Forget for SessionFoldView<'a>

§

impl<'a> Freeze for SessionFoldView<'a>

§

impl<'a> Move for SessionFoldView<'a>

§

impl<'a> Send for SessionFoldView<'a>

§

impl<'a> Sync for SessionFoldView<'a>

§

impl<'a> Unpin for SessionFoldView<'a>

§

impl<'a> UnsafeUnpin for SessionFoldView<'a>

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 = !

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.