pub struct SingleVerifierLease { /* private fields */ }Expand description
An exclusive, process-lifetime lease proving this process is the sole verifier for a replay admission domain (§4.6, shape 1).
The SingleVerifierInstance guarantee is only sound if exactly one process
admits for the domain. An operator env string alone cannot establish that —
two replicas can each set it and silently recreate a per-process replay
split. This lease converts the claim into an OS-enforced fact: it holds an
exclusive, non-blocking advisory lock (flock(LOCK_EX|LOCK_NB)) on an
operator-configured lease path for the whole process lifetime. A second
process attempting to acquire the same lease fails, so its proof admission
stays closed rather than admitting under a guarantee it cannot honour.
The lease path’s storage defines the domain the exclusion spans: a same-host domain uses any local path; a multi-host domain MUST place the lease on storage shared and lock-coherent across every verifier (an operator responsibility the mechanism cannot infer, but which — unlike a bare env string — it does enforce wherever the lock is actually coherent).
Implementations§
Source§impl SingleVerifierLease
impl SingleVerifierLease
Sourcepub fn acquire(path: &Path) -> Result<Self>
pub fn acquire(path: &Path) -> Result<Self>
Acquire the exclusive sole-verifier lease, or fail closed.
Returns Err when another process already holds the lease (the domain
already has a verifier) or the path cannot be opened/locked. The caller
MUST NOT install a SingleVerifierInstance store without holding this.
Auto Trait Implementations§
impl Freeze for SingleVerifierLease
impl RefUnwindSafe for SingleVerifierLease
impl Send for SingleVerifierLease
impl Sync for SingleVerifierLease
impl Unpin for SingleVerifierLease
impl UnsafeUnpin for SingleVerifierLease
impl UnwindSafe for SingleVerifierLease
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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