pub struct SessionPermissions { /* private fields */ }Expand description
One session’s live permission state.
Why: reached from the agent loop (which waits) and from
session.permission.respond (which answers); sharing one Arc is the
whole mechanism.
What: pending maps a request id to the sender the waiting gate holds;
remembered holds this session’s grants and is never shared across
sessions. A poisoned lock never widens: registration drops the sender (the
waiting gate resolves to deny) and a remembered-grant lookup reports “not
remembered” (the call is asked about again).
Test: allow_for_session_is_remembered_for_a_later_matching_call,
allow_for_session_does_not_leak_across_sessions,
abandoned_request_resolves_to_deny.
Implementations§
Source§impl SessionPermissions
impl SessionPermissions
Sourcepub fn respond(
&self,
request_id: &str,
decision: PermissionDecision,
) -> Result<(), RpcError>
pub fn respond( &self, request_id: &str, decision: PermissionDecision, ) -> Result<(), RpcError>
Deliver a client’s answer to the waiting gate.
Why: a request id nobody waits on (already answered, or timed out) is a
client error, not an internal one.
Test: respond_to_unknown_request_is_an_error,
respond_resolves_the_waiting_gate.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SessionPermissions
impl RefUnwindSafe for SessionPermissions
impl Send for SessionPermissions
impl Sync for SessionPermissions
impl Unpin for SessionPermissions
impl UnsafeUnpin for SessionPermissions
impl UnwindSafe for SessionPermissions
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
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> 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> ⓘ
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> ⓘ
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