pub struct SessionFold { /* private fields */ }Expand description
A fold must be bound to one server session at construction.
use muse_code_sdk::fold::SessionFold;
let unbound = SessionFold::default();Implementations§
Source§impl SessionFold
impl SessionFold
Sourcepub fn new(session_id: impl Into<String>) -> Self
pub fn new(session_id: impl Into<String>) -> Self
An empty fold bound to session_id: events for any other session are
ignored.
Sourcepub const fn session_state(&self) -> &SessionState
pub const fn session_state(&self) -> &SessionState
The latest params of each session-state notification the fold applied.
Sourcepub fn active_turn_id(&self) -> Option<&str>
pub fn active_turn_id(&self) -> Option<&str>
The turn whose turn/started the fold applied last, until that turn
completes, is retracted or is unqueued.
Sourcepub fn turn(&self, id: &str) -> Option<&Turn>
pub fn turn(&self, id: &str) -> Option<&Turn>
The record of turn id, or None when no turn event the fold applied
named it.
Sourcepub const fn pending_gap(&self) -> Option<&DeliveryGap>
pub const 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.
Sourcepub const fn is_current(&self) -> bool
pub const fn is_current(&self) -> bool
False while a delivery gap is pending, and for good once the owning
Session lost an event or its session id was opened again on the
same client.
Sourcepub fn gap_filled(&mut self, next: &str) -> bool
pub fn gap_filled(&mut self, next: &str) -> bool
Clears the pending gap when next is its next cursor and returns
true; any other cursor leaves the gap in place and returns false.
Sourcepub fn pending_approval(&self, id: &str) -> Option<&Value>
pub fn pending_approval(&self, id: &str) -> Option<&Value>
The latest params seen for a pending approval: its approval/updated
refresh if any, else its request. pending_approvals keeps both.
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>
Approvals awaiting a durable terminal, in the order they were first requested, 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 the order those first terminals arrived.
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>
Questions awaiting a durable settlement, in the order they were first requested.
Sourcepub fn settled_user_inputs(&self) -> Vec<&Value>
pub fn settled_user_inputs(&self) -> Vec<&Value>
The first durable settlement per question, in the order those first settlements arrived.
Sourcepub fn apply(&mut self, event: &Notification) -> FoldOutcome
pub fn apply(&mut self, event: &Notification) -> FoldOutcome
Folds one event and reports what it changed. Events for another
session and malformed params change nothing. After the owning
Session stops the fold it applies nothing, or only question events
after a re-open.