pub struct InstallSessionRegistry {
sessions: Mutex<HashMap<String, Sender<()>>>,
active_providers: Mutex<HashSet<String>>,
}Expand description
Per-session abort handle so install.cancel can kill an in-flight
install. Also tracks active_providers so concurrent sessions for
the same provider directory are rejected — without that, cancel
of one would rm_rf the shared dir mid-install for the other.
parking_lot::Mutex since the engine is sync at the handler
boundary.
Fields§
§sessions: Mutex<HashMap<String, Sender<()>>>§active_providers: Mutex<HashSet<String>>Implementations§
Source§impl InstallSessionRegistry
impl InstallSessionRegistry
pub fn new() -> Arc<Self>
fn insert(&self, session_id: String, tx: Sender<()>)
Sourcefn try_claim_provider(&self, provider_id: &str) -> bool
fn try_claim_provider(&self, provider_id: &str) -> bool
Try to claim a provider; returns false if another session is already installing this provider.
fn release_provider(&self, provider_id: &str)
fn cancel(&self, session_id: &str) -> bool
fn drop_session(&self, session_id: &str)
Trait Implementations§
Source§impl Default for InstallSessionRegistry
impl Default for InstallSessionRegistry
Source§fn default() -> InstallSessionRegistry
fn default() -> InstallSessionRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for InstallSessionRegistry
impl !RefUnwindSafe for InstallSessionRegistry
impl Send for InstallSessionRegistry
impl Sync for InstallSessionRegistry
impl Unpin for InstallSessionRegistry
impl !UnwindSafe for InstallSessionRegistry
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.