pub struct DeviceEdgeSession { /* private fields */ }Expand description
A device edge session whose identity survives transport route changes.
The session owns a stable id, a stable ledger reference, a mutable current link, an optional device profile binding, an event ledger, a route order, a command queue, and optional visible consent data. Rebinding changes only the route; the id, ledger reference, event history, queued commands, profile, and bound consent remain attached to the same session.
Implementations§
Source§impl DeviceEdgeSession
impl DeviceEdgeSession
Sourcepub fn new(id: Symbol, link: LinkKind) -> Result<Self>
pub fn new(id: Symbol, link: LinkKind) -> Result<Self>
Creates a device edge session using the id as the ledger reference.
Sourcepub fn with_ledger(
id: Symbol,
link: LinkKind,
ledger: LedgerRef,
) -> Result<Self>
pub fn with_ledger( id: Symbol, link: LinkKind, ledger: LedgerRef, ) -> Result<Self>
Creates a device edge session with an explicit ledger reference.
Sourcepub fn ledger_ref(&self) -> &LedgerRef
pub fn ledger_ref(&self) -> &LedgerRef
Returns the stable ledger reference.
Sourcepub fn device_profile(&self) -> Option<&DeviceEdgeProfile>
pub fn device_profile(&self) -> Option<&DeviceEdgeProfile>
Returns the profile bound to this session, if one was registered.
Sourcepub fn bind_profile(&mut self, profile: DeviceEdgeProfile) -> Result<()>
pub fn bind_profile(&mut self, profile: DeviceEdgeProfile) -> Result<()>
Binds provider/profile metadata to the session.
Sourcepub fn route_order(&self) -> &[LinkKind]
pub fn route_order(&self) -> &[LinkKind]
Returns the preferred route order for this session.
Sourcepub fn set_route_order(&mut self, route_order: Vec<LinkKind>) -> Result<()>
pub fn set_route_order(&mut self, route_order: Vec<LinkKind>) -> Result<()>
Replaces the preferred route order.
Sourcepub fn queue_command(&mut self, command: Expr) -> Result<()>
pub fn queue_command(&mut self, command: Expr) -> Result<()>
Queues an actuator command while the current route is unavailable.
Sourcepub fn queued_command_count(&self) -> usize
pub fn queued_command_count(&self) -> usize
Returns the number of queued commands waiting for a route.
Sourcepub fn flushed_commands(&self) -> &[Expr]
pub fn flushed_commands(&self) -> &[Expr]
Returns the commands flushed after route reconnects.
Sourcepub fn flush_queued_commands(&mut self) -> Result<Vec<Expr>>
pub fn flush_queued_commands(&mut self) -> Result<Vec<Expr>>
Flushes queued actuator commands after a route reconnects.
Sourcepub fn event_ledger(&self) -> &EventLedger
pub fn event_ledger(&self) -> &EventLedger
Returns the session event ledger.
Sourcepub fn bound_consent(&self) -> Option<&Expr>
pub fn bound_consent(&self) -> Option<&Expr>
Returns the visible consent data bound to the session, if present.
Sourcepub fn bound_consent_session(&self) -> Option<Symbol>
pub fn bound_consent_session(&self) -> Option<Symbol>
Returns the session symbol embedded in the bound consent data, if any.
Sourcepub fn bind_consent(&mut self, consent: Expr) -> Result<()>
pub fn bind_consent(&mut self, consent: Expr) -> Result<()>
Binds visible consent data to the session and records the ledger event.
Trait Implementations§
Source§impl Clone for DeviceEdgeSession
impl Clone for DeviceEdgeSession
Source§fn clone(&self) -> DeviceEdgeSession
fn clone(&self) -> DeviceEdgeSession
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more