pub(super) struct StudyRegistryGate {
key: ScopeKey,
phase: CreditRegistrationPhase,
test_mode: bool,
is_probe: bool,
has_probed: bool,
tally: Tally,
}Expand description
One iteration’s passage through the circuit breakers and the limiter. The adapter asks it how
much it may send, spends that before sending, and records what came back; nothing else in an
iteration touches breaker or rate_limit.
Fields§
§key: ScopeKey§phase: CreditRegistrationPhase§test_mode: bool§is_probe: boolAfter a breaker’s cooldown: the iteration may send one single-item request, whichever of its flows sends it, and the breaker closes only if that request succeeds.
has_probed: bool§tally: TallyImplementations§
Source§impl StudyRegistryGate
impl StudyRegistryGate
Sourcepub(super) fn admit(
phase: CreditRegistrationPhase,
scope: &RegistrationScope,
test_mode: bool,
) -> Result<Self, PhaseSkipReason>
pub(super) fn admit( phase: CreditRegistrationPhase, scope: &RegistrationScope, test_mode: bool, ) -> Result<Self, PhaseSkipReason>
Lets the iteration run, or says why it waits. Only a phase that calls the study registry ever waits: an outage must not stall the database-only phases.
Sourcepub(super) fn is_probe(&self) -> bool
pub(super) fn is_probe(&self) -> bool
Whether the iteration is a breaker’s probe: see Self::allowance.
Sourcepub(super) fn allowance(&self, endpoint: SuotarEndpoint) -> usize
pub(super) fn allowance(&self, endpoint: SuotarEndpoint) -> usize
How many items one request to endpoint may carry now: its batch size, cut to what the
limiter allows, or during a probe one item for the first request and none after it. For
list-by-course, whose limiter counts requests, how many requests.
Sourcepub(super) fn spend(&mut self, endpoint: SuotarEndpoint, count: usize)
pub(super) fn spend(&mut self, endpoint: SuotarEndpoint, count: usize)
Spends count of what Self::allowance allowed, just before the request leaves.
Sourcepub(super) fn spend_split(&mut self, endpoint: SuotarEndpoint, count: usize)
pub(super) fn spend_split(&mut self, endpoint: SuotarEndpoint, count: usize)
Self::spend for the resent halves of a batch refused as malformed, which may go past
the allowance; see rate_limit::overdraw.
Sourcepub(super) fn record(
&mut self,
endpoint: SuotarEndpoint,
exchange: Exchange<'_>,
)
pub(super) fn record( &mut self, endpoint: SuotarEndpoint, exchange: Exchange<'_>, )
Records what one request to endpoint came to, for Self::settle.
Sourcepub(super) fn settle(self) -> Option<String>
pub(super) fn settle(self) -> Option<String>
Applies what the iteration’s exchanges said to the breakers and the limiter, and returns the iteration’s error, if any. A request refused with its row alone is reported only when nothing answered, and counts against no breaker.
The limiter drops to its floor whenever the shared breaker trips or closes again, so the ramp back starts from the probe that got through rather than from a failure a long cooldown ago.
Auto Trait Implementations§
impl Freeze for StudyRegistryGate
impl RefUnwindSafe for StudyRegistryGate
impl Send for StudyRegistryGate
impl Sync for StudyRegistryGate
impl Unpin for StudyRegistryGate
impl UnsafeUnpin for StudyRegistryGate
impl UnwindSafe for StudyRegistryGate
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> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].