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<'_>
impl SessionFoldView<'_>
Sourcepub fn item(&self, id: &str) -> Option<Value>
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.
Sourcepub fn item_count(&self) -> usize
pub fn item_count(&self) -> usize
How many items the fold holds; items are never removed.
Sourcepub fn item_ids(&self) -> Vec<String>
pub fn item_ids(&self) -> Vec<String>
Item ids in first-seen order (resume history first, in served order).
Sourcepub fn accumulated(&self, id: &str, field: &str) -> Option<String>
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.
Sourcepub fn session_state(&self, family: &str) -> Option<Value>
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.
Sourcepub fn active_turn_id(&self) -> Option<String>
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.
Sourcepub fn turn(&self, id: &str) -> Option<Turn>
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).
Sourcepub fn pending_gap(&self) -> Option<DeliveryGap>
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).
Sourcepub fn is_current(&self) -> bool
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.
Sourcepub fn is_stopped(&self) -> bool
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.
Sourcepub fn pending_approval(&self, id: &str) -> Option<Value>
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.
Sourcepub fn resolved_approval(&self, id: &str) -> Option<Value>
pub fn resolved_approval(&self, id: &str) -> Option<Value>
The first approval/resolved params of approval id; a later
terminal never replaces it.
Sourcepub fn pending_approvals(&self) -> Vec<PendingApproval>
pub fn pending_approvals(&self) -> Vec<PendingApproval>
Pending approvals in first-request order, each with its latest request and latest update.
Sourcepub fn resolved_approvals(&self) -> Vec<Value>
pub fn resolved_approvals(&self) -> Vec<Value>
The first durable terminal per approval, in first-resolution order.
Sourcepub fn pending_user_input(&self, id: &str) -> Option<Value>
pub fn pending_user_input(&self, id: &str) -> Option<Value>
The latest userInput/requested params of question id while it
awaits its first settlement.
Sourcepub fn settled_user_input(&self, id: &str) -> Option<Value>
pub fn settled_user_input(&self, id: &str) -> Option<Value>
The first userInput/settled params of question id; a later
settlement never replaces it.
Sourcepub fn pending_user_inputs(&self) -> Vec<Value>
pub fn pending_user_inputs(&self) -> Vec<Value>
Pending user-input requests in first-request order.
Sourcepub fn settled_user_inputs(&self) -> Vec<Value>
pub fn settled_user_inputs(&self) -> Vec<Value>
Settled user-input requests in first-settlement order.