Regulator v0.1.0 Regulator.Limit behaviour View Source

Provides a behaviour for defining new limit algorithms

Link to this section Summary

Callbacks

The initial limit.

Creates a new limit configuration.

Recalculates the new limit based on the previous limit, the most recent window, and the configuration for the limit. Must return the limit configuration with the new limit in a tuple.

Link to this section Callbacks

Specs

initial(term()) :: pos_integer()

The initial limit.

Specs

new(term()) :: term()

Creates a new limit configuration.

Link to this callback

update(term, pos_integer, arg3)

View Source

Specs

update(term(), pos_integer(), Regulator.Window.t()) :: {term(), pos_integer()}

Recalculates the new limit based on the previous limit, the most recent window, and the configuration for the limit. Must return the limit configuration with the new limit in a tuple.