Skip to main content

Module hooks

Module hooks 

Source
Expand description

The hooks a venue gives HttpClient::send.

The loop is core’s; a venue supplies three hooks and composes its state inside them:

  • a Throttle, which charges each attempt before it is sent, sees every response, and holds every request when the server says to;
  • a RetryPolicy, which decides from a response whether the request is done, retried or failed, and whether everyone is held;
  • an Authenticator, which signs each attempt afresh.

Each attempt runs: concurrency permit, Throttle::acquire, Authenticator::sign, send, Throttle::observe, RetryPolicy::decide, then Throttle::hold when the decision carries a hold.

Structs§

AttemptInfo
Which attempt a response answers.
Charge
Everything a throttle charged for one attempt, handed back to it in Throttle::observe. The loop never reads it.
Cost
What a request costs one layer of a throttle.
Decision
A policy’s answer to one response.
DefaultRetryPolicy
Core’s policy: a 429 is retried and holds every request, a 2xx is done, and every other status fails.
DynAuthenticator
Dyn-compatible wrapper for Authenticator.
DynRetryPolicy
Dyn-compatible wrapper for RetryPolicy.
DynThrottle
Dyn-compatible wrapper for Throttle.
LayerCharge
What one layer charged for one attempt.
LayerId
A throttle layer, named by the venue that declares it.
NoThrottle
A throttle that charges nothing and holds nothing: a client built without one.
Refused
A cost a layer can never hold, refused before anything is sent.
RequestMeta
The request an attempt is about to send, as a throttle sees it.
RequestParts
A request before it is sent. The loop clones it for each attempt and hands the clone to Authenticator::sign.
ResponseMeta
A response, as a throttle and a policy see it.

Enums§

Outcome
What the loop does with a response.

Traits§

Authenticator
Signs an attempt before it is sent.
RetryPolicy
Decides from a response what the loop does next.
Throttle
Charges each attempt, sees each response, and holds every request on it.