pub(super) struct Gate<'a> {
pub(super) session: &'a SessionManager,
pub(super) execute_by: Instant,
pub(super) offline_grace: Duration,
pub(super) last_ok: &'a (dyn Fn() -> Instant + Send + Sync),
pub(super) cancel: &'a CancellationToken,
}Expand description
Decides, before each target-side try, whether the attempt may proceed; see Gate::check.
Fields§
§session: &'a SessionManager§execute_by: Instant§offline_grace: Duration§last_ok: &'a (dyn Fn() -> Instant + Send + Sync)§cancel: &'a CancellationTokenImplementations§
Source§impl Gate<'_>
impl Gate<'_>
Sourcepub(super) async fn check(&self) -> Result<(), AbortReason>
pub(super) async fn check(&self) -> Result<(), AbortReason>
Waits until the attempt may start its next target-side try, or returns why it must abort.
Runs before every try (via with_retries_gated), so it never interrupts a call in flight.
Each pass checks, in order:
- The lease and cancellation: past
execute_byaborts asAbortReason::LeaseExpired, a cancelled run asAbortReason::Cancelled. - The session phase.
RevokedorClosedaborts asAbortReason::SessionLost.ExpiredorAuthenticatingrenews the token viabearer, bounded byexecute_by, then re-checks; renewal that keeps failing until the deadline counts as lease expiry. - Connectivity: an
Activesession with no server contact for longer thanoffline_gracewaits for it to recover (seewait_for_connectivity), then re-checks.
Only an Active, connected session within its lease returns Ok.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Gate<'a>
impl<'a> !UnwindSafe for Gate<'a>
impl<'a> Freeze for Gate<'a>
impl<'a> Send for Gate<'a>
impl<'a> Sync for Gate<'a>
impl<'a> Unpin for Gate<'a>
impl<'a> UnsafeUnpin for Gate<'a>
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Consume a handle, getting back the initial
Arc<> Read more§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