pub struct Sessions {
state: Mutex<State>,
sends: Mutex<HashMap<String, VecDeque<Instant>>>,
}Fields§
§state: Mutex<State>The open sessions and the packages being uninstalled, under one lock, so a session can’t open between an uninstall’s check and its prune.
sends: Mutex<HashMap<String, VecDeque<Instant>>>Implementations§
Source§impl Sessions
impl Sessions
fn state(&self) -> MutexGuard<'_, State>
Sourcepub fn begin_removal(&self, id: &str)
pub fn begin_removal(&self, id: &str)
Ends every session of id and refuses new ones until
Sessions::end_removal: an uninstall calls this before it deletes
the widget’s data, so an open pane can’t write it back meanwhile.
Sourcepub fn end_removal(&self, id: &str)
pub fn end_removal(&self, id: &str)
Call once srv’s package list no longer has the widget, so no session can open for it from a stale list.
Sourcepub fn open(
&self,
packages: &[WidgetPackageInfo],
id: &str,
hash: &str,
) -> Result<String, AccessError>
pub fn open( &self, packages: &[WidgetPackageInfo], id: &str, hash: &str, ) -> Result<String, AccessError>
A token for one pane of an approved package at hash.
pub fn close(&self, token: &str)
The session’s package, if it may still run: approved at the hash the session was opened for. An edited, re-approved, disabled or removed package ends every session of the old version.
Sourcepub fn take_send(&self, widget_id: &str) -> Result<(), AccessError>
pub fn take_send(&self, widget_id: &str) -> Result<(), AccessError>
Counts one agents.send for the package, or refuses it over the rate.
fn take_send_at(&self, widget_id: &str, now: Instant) -> Result<(), AccessError>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Sessions
impl RefUnwindSafe for Sessions
impl Send for Sessions
impl Sync for Sessions
impl Unpin for Sessions
impl UnsafeUnpin for Sessions
impl UnwindSafe for Sessions
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.