package core_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type nonrec t = private t
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val create_exn : now:Core_kernel.Time_ns.t -> burst_size:int -> sustained_rate_per_sec:float -> t

A Token_bucket.Starts_full.t is a Token_bucket.t that is statically guaranteed to have been called with initial_bucket_level equal to burst_size. The advantage of such a guarantee is that there's a clear semantics for increasing the bucket limit (implemented in try_increase_bucket_limit).

This is not to say that other subtypes of Limiter.t don't have reasonable semantics for increasing their limits in some way, but Limiter.t is general enough that they should probably be considered on a case-by-case basis.

val try_increase_bucket_limit : t -> new_limit:int -> Try_increase_bucket_limit_result.t

Increases the bucket_limit and the current bucket_level by the difference between the current and new bucket limits. Decreasing the bucket_limit may cause the bucket_level to become negative, breaking an invariant. If the new limit is lower than the current limit, Unable is returned.

OCaml

Innovation. Community. Security.