pub struct Session { /* private fields */ }Expand description
Traffic context for a connection or request, created by Handle::session or Handle::request.
Cheap to clone (an Arc inside): one context is shared by both origin handles
of a session (its publish and subscribe halves) so presence and viewer counts
are never double-attributed. It carries three things:
- the tier and label, so any broadcast reached through a tagged origin handle
resolves the right per-
(path, tier)counters and its bytes count toward the label, - the presence gauge:
sessions_startedbumps when the context is created andsessions_endedwhen the last clone drops; a request instead bumpsrequestsonce at admission and never touches session presence, - the egress viewer refcount map (first/last active subscription per broadcast),
driving
broadcasts_started/broadcasts_ended.
Session::retag moves a live context to another tier and label: presence and traffic
recorded afterwards land there, while what was already counted stays put and an
open subscription or announce closes on the tier it opened on.
Session::default is the no-op context (disabled registry / untagged caller):
every bump reached through it is silently dropped, so a handle can hold one
unconditionally instead of threading an Option.
Implementations§
Trait Implementations§
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