pub struct GatewaySessionTable { /* private fields */ }Expand description
Bounded in-memory gateway session and route table.
Implementations§
Source§impl GatewaySessionTable
impl GatewaySessionTable
Sourcepub fn new(config: GatewayConfig) -> Self
pub fn new(config: GatewayConfig) -> Self
Creates an empty gateway session table.
Sourcepub const fn config(&self) -> GatewayConfig
pub const fn config(&self) -> GatewayConfig
Returns configuration.
Sourcepub const fn stats(&self) -> GatewayStats
pub const fn stats(&self) -> GatewayStats
Returns statistics.
Sourcepub fn session(&self, client_id: ClientId) -> Option<&GatewaySession>
pub fn session(&self, client_id: ClientId) -> Option<&GatewaySession>
Returns a session by client id.
Sourcepub fn route(&self, client_id: ClientId) -> Result<GatewayRoute, GatewayError>
pub fn route(&self, client_id: ClientId) -> Result<GatewayRoute, GatewayError>
Returns a connected route by client id.
Sourcepub fn connect(
&mut self,
client_id: ClientId,
station_id: StationId,
now: Tick,
) -> Result<GatewayConnectReport, GatewayError>
pub fn connect( &mut self, client_id: ClientId, station_id: StationId, now: Tick, ) -> Result<GatewayConnectReport, GatewayError>
Connects a client, reconnecting within grace or replacing stale sessions.
Sourcepub fn reconnect(
&mut self,
client_id: ClientId,
generation: u64,
now: Tick,
) -> Result<GatewayConnectReport, GatewayError>
pub fn reconnect( &mut self, client_id: ClientId, generation: u64, now: Tick, ) -> Result<GatewayConnectReport, GatewayError>
Reconnects a disconnected client by generation.
Sourcepub fn disconnect(
&mut self,
client_id: ClientId,
now: Tick,
) -> Result<(), GatewayError>
pub fn disconnect( &mut self, client_id: ClientId, now: Tick, ) -> Result<(), GatewayError>
Marks a connected session disconnected.
Sourcepub fn expire_disconnected(&mut self, now: Tick) -> usize
pub fn expire_disconnected(&mut self, now: Tick) -> usize
Removes disconnected sessions whose grace window has expired.
Sourcepub fn expiry_deadline_len(&self) -> usize
pub fn expiry_deadline_len(&self) -> usize
Deadline entries retained for caller-driven expiry maintenance.
Sourcepub fn expiry_deadline_capacity(&self) -> usize
pub fn expiry_deadline_capacity(&self) -> usize
Allocated deadline-entry capacity retained by the table.
Sourcepub fn reroute(
&mut self,
client_id: ClientId,
station_id: StationId,
now: Tick,
) -> Result<GatewayRoute, GatewayError>
pub fn reroute( &mut self, client_id: ClientId, station_id: StationId, now: Tick, ) -> Result<GatewayRoute, GatewayError>
Changes the target station for a connected client.
Sourcepub fn admit_command(
&mut self,
command: &CommandEnvelope,
) -> Result<GatewayCommandAdmission, GatewayError>
pub fn admit_command( &mut self, command: &CommandEnvelope, ) -> Result<GatewayCommandAdmission, GatewayError>
Applies session metadata checks to a command and returns the route that should receive it.
Sourcepub fn admit_sequence(
&mut self,
client_id: ClientId,
sequence: u64,
now: Tick,
) -> Result<GatewayCommandAdmission, GatewayError>
pub fn admit_sequence( &mut self, client_id: ClientId, sequence: u64, now: Tick, ) -> Result<GatewayCommandAdmission, GatewayError>
Applies session metadata checks to a client command sequence.
Trait Implementations§
Source§impl Clone for GatewaySessionTable
impl Clone for GatewaySessionTable
Source§fn clone(&self) -> GatewaySessionTable
fn clone(&self) -> GatewaySessionTable
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GatewaySessionTable
impl Debug for GatewaySessionTable
Auto Trait Implementations§
impl Freeze for GatewaySessionTable
impl RefUnwindSafe for GatewaySessionTable
impl Send for GatewaySessionTable
impl Sync for GatewaySessionTable
impl Unpin for GatewaySessionTable
impl UnsafeUnpin for GatewaySessionTable
impl UnwindSafe for GatewaySessionTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more