pub struct SessionRegistry {
pub sessions: RwLock<HashMap<String, Arc<Mutex<Session>>>>,
/* private fields */
}Fields§
§sessions: RwLock<HashMap<String, Arc<Mutex<Session>>>>Implementations§
Source§impl SessionRegistry
impl SessionRegistry
pub fn new() -> SessionRegistry
pub fn with_persistence<P>(dir: P) -> Result<SessionRegistry, Error>
Sourcepub async fn persist_snapshot(&self) -> Result<(), Error>
pub async fn persist_snapshot(&self) -> Result<(), Error>
Snapshot every session (locking each briefly) and persist. Never holds the map lock across the per-session locks or the fs write.
Clone the shared handle for a session (brief map read; no session lock).
pub async fn get_session(&self, session_id: &str) -> Option<Session>
pub async fn get_all_sessions(&self) -> Vec<Session>
pub async fn insert_recovered_session( &self, session_id: String, session: Session, )
pub async fn count_open_sessions_for_initiator(&self, sender: &str) -> usize
Trait Implementations§
Source§impl Default for SessionRegistry
impl Default for SessionRegistry
Source§fn default() -> SessionRegistry
fn default() -> SessionRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for SessionRegistry
impl !RefUnwindSafe for SessionRegistry
impl !UnwindSafe for SessionRegistry
impl Send for SessionRegistry
impl Sync for SessionRegistry
impl Unpin for SessionRegistry
impl UnsafeUnpin for SessionRegistry
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request