pub struct ClientSpinner { /* private fields */ }
Expand description
A struct responsible for performing batch requests and probes with retry logic.
This struct abstracts the client and provides methods to perform multiple probes or requests with retry capabilities. The number of retries can be configured during initialization.
Implementations§
Source§impl ClientSpinner
impl ClientSpinner
Sourcepub fn new(client: Client) -> Self
pub fn new(client: Client) -> Self
Creates a new instance of ClientSpinner
with the given Client
.
This constructor initializes a ClientSpinner
with a client and sets the
number of retries to 0
(no retries).
Sourcepub fn with_retries(self, n_retires: usize) -> Self
pub fn with_retries(self, n_retires: usize) -> Self
Sets the number of retries for subsequent probes and requests.
Sourcepub async fn probe_batch(
&self,
inputs: &[ProbeInput],
) -> Result<Vec<ProbeOutcome>>
pub async fn probe_batch( &self, inputs: &[ProbeInput], ) -> Result<Vec<ProbeOutcome>>
Performs a batch of probes asynchronously with retries.
This method takes an array of ProbeInput
and attempts to probe each one.
If a probe fails, it will retry up to n_retries
times before returning the
results.
Sourcepub async fn request_batch(
&self,
inputs: &[RequestInput],
) -> Result<Vec<RequestOutcome>>
pub async fn request_batch( &self, inputs: &[RequestInput], ) -> Result<Vec<RequestOutcome>>
Performs a batch of requests asynchronously with retries.
This method takes an array of RequestInput
and attempts to request each one.
If a request fails, it will retry up to n_retries
times before returning the
results.