Up

Module Limiter

Signature

type t
val sexp_of_t : t -> Sexplib.Sexp.t
type limiter = t
val sexp_of_limiter : limiter -> Sexplib.Sexp.t
module Infinite_or_finite : sig .. end
module Try_take_result : sig .. end
module Tokens_may_be_available_result : sig .. end
module Token_bucket : sig .. end
Implements a basic token bucket based rate limiter.
module Throttle : sig .. end
Implements a basic throttle.
module Throttled_rate_limiter : sig .. end
A Throttled_rate_limiter combines a Token_bucket and a Throttle.
common read-only operations
val bucket_limit : t -> float
val in_bucket : t -> now:Time.t -> float

tokens available to immediately take

val in_hopper : t -> now:Time.t -> float Infinite_or_finite.t

tokens waiting to drop at the hopper_to_bucket_rate_per_sec

val in_flight : t -> now:Time.t -> float

tokens that have been taken, but not yet returned

val in_limiter : t -> now:Time.t -> float Infinite_or_finite.t

total number of tokens in the limiter in_hopper + in_bucket

val in_system : t -> now:Time.t -> float Infinite_or_finite.t

total number of tokens in the entire system in_hopper + in_bucket + in_flight

val hopper_to_bucket_rate_per_sec : t -> float Infinite_or_finite.t
module Expert : sig .. end
include Core_kernel.Std.Invariant.S with type t := t
type t
val invariant : t Invariant_intf.inv