pub struct Session {
id: SessionId,
sender: UnboundedSender<(UnboundedSender<Response>, Command)>,
connection_count: AtomicU32,
shutdown_requested: AtomicBool,
pack_names: RwLock<Vec<String>>,
}Expand description
A session represents a single client’s connection state.
Each session has its own background thread for processing commands, ensuring complete isolation between clients.
Fields§
§id: SessionIdUnique identifier for this session.
sender: UnboundedSender<(UnboundedSender<Response>, Command)>Sender to communicate with this session’s background thread.
connection_count: AtomicU32Number of active connections using this session.
shutdown_requested: AtomicBoolWhether this session has been marked for shutdown.
pack_names: RwLock<Vec<String>>Names of the pack files currently open in this session.
Implementations§
Source§impl Session
impl Session
Sourcepub fn disconnect(&self)
pub fn disconnect(&self)
Decrement the connection count.
Sourcepub fn connection_count(&self) -> u32
pub fn connection_count(&self) -> u32
Get the current connection count.
Sourcepub fn is_shutdown_requested(&self) -> bool
pub fn is_shutdown_requested(&self) -> bool
Check if shutdown has been requested.
Sourcepub fn pack_names(&self) -> Vec<String>
pub fn pack_names(&self) -> Vec<String>
Get the pack names for this session.
Sourcepub fn add_pack_name(&self, name: &str)
pub fn add_pack_name(&self, name: &str)
Add a pack name to this session.
Sourcepub fn remove_pack_name(&self, name: &str)
pub fn remove_pack_name(&self, name: &str)
Remove a pack name from this session.
Auto Trait Implementations§
impl !Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.