Skip to main content

SessionManager

Struct SessionManager 

Source
pub struct SessionManager { /* private fields */ }
Expand description

Tracks open sessions, identity staleness, and the mutation lease.

Implementations§

Source§

impl SessionManager

Source

pub fn new( identity: ProxyIdentity, resources: BTreeMap<ResourceId, MmioResource>, ceiling: BTreeMap<ResourceId, ResourceCeiling>, allow_mutating_sessions: bool, ) -> Self

Creates a manager for one proxy instance.

Source

pub fn with_limits( identity: ProxyIdentity, resources: BTreeMap<ResourceId, MmioResource>, ceiling: BTreeMap<ResourceId, ResourceCeiling>, allow_mutating_sessions: bool, limit_enforcer: AccessLimitEnforcer, ) -> Self

Creates a manager with explicit access limit enforcer.

Source

pub fn set_quiesce_hook(&mut self, hook: QuiesceHook)

Registers a synchronous quiesce callback invoked with true when a mutating session opens and false when it closes.

Source

pub fn is_quiesced(&self) -> bool

Returns whether the driver is currently quiesced due to an active mutating session.

Source

pub fn quiesce_flag(&self) -> Arc<AtomicBool> ⓘ

Returns a cloneable handle to the atomic quiesce flag so driver background loops can check quiesce state without locking.

Source

pub fn identity(&self) -> &ProxyIdentity

The identity Describe reports and expectations are checked against.

Source

pub fn resources(&self) -> &BTreeMap<ResourceId, MmioResource>

The resource descriptions offered by this instance.

Source

pub fn open_session( &mut self, context: RunContext, mode: SessionMode, expectations: &ProxyIdentity, allowlist: impl IntoIterator<Item = AccessRule>, ) -> Result<u64, OpenError>

Opens a session. Stale identity is rejected before allowlist validation; a rejected allowlist creates no session.

Source

pub fn check_access( &mut self, session_id: u64, class: AccessClass, now_ns: i64, ) -> Result<(), Denial>

Enforces access-class rate limit for session_id.

Source

pub fn check_deadline( &self, session_id: u64, requested_timeout_ns: i64, ) -> Result<(), Denial>

Enforces deadline limit for session_id.

Source

pub fn session(&self, id: u64) -> Option<&Session>

The session with id, if open.

Source

pub fn close_session(&mut self, id: u64) -> bool

Closes a session, releasing the mutation lease and unquiescing the driver if it held the lease. Returns whether the session existed.

Source

pub fn reject_new_sessions(&mut self)

Stop path: reject all new sessions and release any active mutation lease / quiesce state.

Source

pub fn is_accepting(&self) -> bool

Whether new sessions are being accepted.

Source

pub fn open_count(&self) -> usize

Number of open sessions.

Trait Implementations§

Source§

impl Debug for SessionManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.