Skip to main content

drive

Function drive 

Source
pub fn drive<T, E>(
    call: impl FnMut() -> Result<Completion<T>, E>,
    timeout: Duration,
    sleep: impl FnMut(Duration) -> bool,
) -> Result<Driven<T>, E>
Expand description

Call call until it is Completion::Done, waiting the server’s Retry-After between calls. call sends the same request every time: the caller signs once and re-sends the identical statement bytes (SPEC-WRITE-GRANTS §5.2: the same epoch is a retry), never a fresh nonce.

timeout is a wall-clock bound measured from the first call: a re-send is not started when the time already spent plus the next delay would pass it. sleep may cancel (Ctrl-C). Cancellation is observed while waiting, not inside an RPC in flight (each RPC is bounded by the transport’s own timeout).

§Errors

Whatever call returns.