SessionManager

Struct SessionManager 

Source
pub struct SessionManager {
    pub sessions: HashMap<NodeId, Arc<RwLock<Session>>>,
    pub sessions_terminated: bool,
}

Fields§

§sessions: HashMap<NodeId, Arc<RwLock<Session>>>§sessions_terminated: bool

Implementations§

Source§

impl SessionManager

Source

pub fn len(&self) -> usize

Source

pub fn first(&self) -> Option<Arc<RwLock<Session>>>

Source

pub fn sessions_terminated(&self) -> bool

Source

pub fn clear(&mut self)

Puts all sessions into a terminated state and clears the map

Source

pub fn find_session_by_id( &self, session_id: &NodeId, ) -> Option<Arc<RwLock<Session>>>

Find a session by its session id and return it.

Source

pub fn find_session_by_token( &self, authentication_token: &NodeId, ) -> Option<Arc<RwLock<Session>>>

Finds the session by its authentication token and returns it. The authentication token can be renewed so it is not used as a key.

Source

pub fn register_session(&mut self, session: Arc<RwLock<Session>>)

Register the session in the map so it can be searched on

Source

pub fn deregister_session( &mut self, session: Arc<RwLock<Session>>, ) -> Option<Arc<RwLock<Session>>>

Deregisters a session from the map

Trait Implementations§

Source§

impl Default for SessionManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.