jon.recoil.org

Module Stdlib.BackoffSource

Randomized exponential backoff mechanism.

Sourcetype t

Type of backoff values.

Sourceval max_wait_log : int @@ portable

Logarithm of the maximum allowed value for wait.

Sourceval create : ?lower_wait_log:int -> ?upper_wait_log:int -> unit -> Stdlib.Backoff.t @@ portable

create creates a backoff value. upper_wait_log, lower_wait_log override the logarithmic upper and lower bound on the number of spins executed by once.

Sourceval default : Stdlib.Backoff.t @@ portable

default is equivalent to create ().

Sourceval once : Stdlib.Backoff.t -> Stdlib.Backoff.t @@ portable

once b executes one random wait and returns a new backoff with logarithm of the current maximum value incremented unless it is already at upper_wait_log of b.

Note that this uses the default Stdlib Random per-domain generator.

Sourceval reset : Stdlib.Backoff.t -> Stdlib.Backoff.t @@ portable

reset b returns a backoff equivalent to b except with current value set to the lower_wait_log of b.

Sourceval get_wait_log : Stdlib.Backoff.t -> int @@ portable

get_wait_log b returns logarithm of the maximum value of wait for next once.