pub struct ReconfigInFlight { /* private fields */ }Expand description
In-flight reconfig guard. Used by [SessionActor] to detect concurrent
setPreferences calls and reject the second one with
ApplyError::ConcurrentReconfig.
The guard is RAII — lock returns a ReconfigGuard that releases
the slot on drop. If a second caller arrives while the guard is held,
try_lock returns None and the caller errors out.
We use Arc<Mutex<bool>> rather than a Semaphore(1) because we need
try_lock semantics (fail-fast, not block) and the body of the
critical section runs &mut self on the actor — a Tokio Mutex would
require extra await points that complicate the actor’s select! loop.
Implementations§
Source§impl ReconfigInFlight
impl ReconfigInFlight
Sourcepub fn try_lock(&self) -> Option<ReconfigGuard<'_>>
pub fn try_lock(&self) -> Option<ReconfigGuard<'_>>
Try to acquire the in-flight slot.
Returns Some(ReconfigGuard) on success — the guard releases the
slot on drop. Returns None if a concurrent call still holds the
slot (caller must error out with ApplyError::ConcurrentReconfig).
Trait Implementations§
Source§impl Clone for ReconfigInFlight
impl Clone for ReconfigInFlight
Source§fn clone(&self) -> ReconfigInFlight
fn clone(&self) -> ReconfigInFlight
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more