pub struct PendingBackgroundPids {
inner: Mutex<HashMap<String, PendingEntry>>,
}Fields§
§inner: Mutex<HashMap<String, PendingEntry>>Implementations§
Source§impl PendingBackgroundPids
impl PendingBackgroundPids
pub fn new() -> Self
fn evict_expired_locked(guard: &mut HashMap<String, PendingEntry>, now_ms: i64)
Sourcepub fn set_or_stash<E>(
&self,
id: &str,
pid: i64,
now_ms: i64,
try_set: impl FnOnce(i64) -> Result<bool, E>,
) -> Result<(), E>
pub fn set_or_stash<E>( &self, id: &str, pid: i64, now_ms: i64, try_set: impl FnOnce(i64) -> Result<bool, E>, ) -> Result<(), E>
Called from the pid-arrival side (COMMAND_BACKGROUND_TASK_PID).
Runs try_set(pid) (the background_task_set_pid DB call) while
holding this module’s lock; if it reports the row doesn’t exist yet
(Ok(false)), stashes the pid instead of losing it. Atomic with
observe_and_apply below for the same id — see the module doc
comment for why that matters.
Sourcepub fn observe_and_apply<E>(
&self,
id: &str,
now_ms: i64,
apply: impl FnOnce(i64) -> Result<bool, E>,
) -> Result<(), E>
pub fn observe_and_apply<E>( &self, id: &str, now_ms: i64, apply: impl FnOnce(i64) -> Result<bool, E>, ) -> Result<(), E>
Called from the row-creation side (COMMAND_DOCK_NODE_STATUS),
after its own background_task_observe(...) call. Checks for a
pid stashed ahead of the row’s existence and, if present and not
expired, applies it via apply (another background_task_set_pid
call) while holding this module’s lock. Atomic with set_or_stash
above for the same id.
Trait Implementations§
Source§impl Default for PendingBackgroundPids
impl Default for PendingBackgroundPids
Source§fn default() -> PendingBackgroundPids
fn default() -> PendingBackgroundPids
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for PendingBackgroundPids
impl !RefUnwindSafe for PendingBackgroundPids
impl Send for PendingBackgroundPids
impl Sync for PendingBackgroundPids
impl Unpin for PendingBackgroundPids
impl UnsafeUnpin for PendingBackgroundPids
impl UnwindSafe for PendingBackgroundPids
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.