pub struct SessionState {
pub sid: SessionId,
pub roles: Vec<String>,
pub local_types: BTreeMap<Endpoint, TypeEntry>,
pub buffers: BTreeMap<Edge, SignedBuffer<Signature>>,
pub auth_leaves: BTreeMap<Edge, Vec<Hash>>,
pub auth_trees: BTreeMap<Edge, AuthTree>,
pub auth_roots: BTreeMap<Edge, Hash>,
pub edge_handlers: BTreeMap<Edge, HandlerId>,
pub default_handler: HandlerId,
pub edge_traces: BTreeMap<Edge, Vec<ValType>>,
pub status: SessionStatus,
pub epoch: usize,
/* private fields */
}Expand description
State of a single session.
Stores per-endpoint local types (the type truth), message buffers,
and lifecycle status. Matches Lean SessionState.
Fields§
§sid: SessionIdSession identifier.
roles: Vec<String>Role names in this session.
local_types: BTreeMap<Endpoint, TypeEntry>Per-endpoint local type state. This IS the type truth.
Matches Lean localTypes : List (Endpoint × LocalType).
buffers: BTreeMap<Edge, SignedBuffer<Signature>>Message buffers keyed by directed edge.
auth_leaves: BTreeMap<Edge, Vec<Hash>>Per-edge authenticated leaves for Merkle-auth tracking.
auth_trees: BTreeMap<Edge, AuthTree>Per-edge Merkle trees for incremental authenticated updates.
auth_roots: BTreeMap<Edge, Hash>Per-edge Merkle roots for signed-buffer history.
edge_handlers: BTreeMap<Edge, HandlerId>Optional handler binding per edge.
default_handler: HandlerIdSession-wide fallback handler id.
edge_traces: BTreeMap<Edge, Vec<ValType>>Coherence trace by edge.
status: SessionStatusCurrent status.
epoch: usizeEpoch counter for draining.
Implementations§
Source§impl SessionState
impl SessionState
Sourcepub fn send_signed(
&mut self,
from: &str,
to: &str,
signed: &SignedValue<Signature>,
) -> Result<EnqueueResult, String>
pub fn send_signed( &mut self, from: &str, to: &str, signed: &SignedValue<Signature>, ) -> Result<EnqueueResult, String>
Send a signed value from one role to another.
§Errors
Returns an error if no buffer exists for the given edge.
Sourcepub fn send(
&mut self,
from: &str,
to: &str,
val: Value,
) -> Result<EnqueueResult, String>
pub fn send( &mut self, from: &str, to: &str, val: Value, ) -> Result<EnqueueResult, String>
Send a value from one role to another.
Returns the enqueue result from the buffer.
§Errors
Returns an error if no buffer exists for the given edge.
Sourcepub fn send_with_sequence(
&mut self,
from: &str,
to: &str,
val: Value,
sequence_no: u64,
) -> Result<EnqueueResult, String>
pub fn send_with_sequence( &mut self, from: &str, to: &str, val: Value, sequence_no: u64, ) -> Result<EnqueueResult, String>
Send a value from one role to another with explicit sequence number.
§Errors
Returns an error if no buffer exists for the given edge.
Sourcepub fn recv_signed(
&mut self,
from: &str,
to: &str,
) -> Option<SignedValue<Signature>>
pub fn recv_signed( &mut self, from: &str, to: &str, ) -> Option<SignedValue<Signature>>
Receive a signed value destined for a role from a specific sender.
Sourcepub fn recv_verified_signed(
&mut self,
from: &str,
to: &str,
) -> Result<Option<SignedValue<Signature>>, String>
pub fn recv_verified_signed( &mut self, from: &str, to: &str, ) -> Result<Option<SignedValue<Signature>>, String>
Receive and verify a value destined for a role from a specific sender.
§Errors
Returns an error if signature verification fails.
Sourcepub fn recv_verified(
&mut self,
from: &str,
to: &str,
) -> Result<Option<Value>, String>
pub fn recv_verified( &mut self, from: &str, to: &str, ) -> Result<Option<Value>, String>
Receive and verify a value destined for a role from a specific sender.
§Errors
Returns an error if signature verification fails.
Sourcepub fn recv(&mut self, from: &str, to: &str) -> Option<Value>
pub fn recv(&mut self, from: &str, to: &str) -> Option<Value>
Receive a value destined for a role from a specific sender.
Sourcepub fn has_message(&self, from: &str, to: &str) -> bool
pub fn has_message(&self, from: &str, to: &str) -> bool
Check if there is a message available on an edge.
Sourcepub fn lookup_handler_for_roles(
&self,
from: &str,
to: &str,
) -> Option<&HandlerId>
pub fn lookup_handler_for_roles( &self, from: &str, to: &str, ) -> Option<&HandlerId>
Lookup an edge-bound handler by role pair using the internal numeric path.
Sourcepub fn default_handler_binding(&self) -> Option<&HandlerId>
pub fn default_handler_binding(&self) -> Option<&HandlerId>
Lookup the session-wide fallback handler using the internal numeric path.
Sourcepub fn has_bound_handler(&self) -> bool
pub fn has_bound_handler(&self) -> bool
Whether the session currently has any handler binding configured.
Trait Implementations§
Source§impl Clone for SessionState
impl Clone for SessionState
Source§fn clone(&self) -> SessionState
fn clone(&self) -> SessionState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more