Pristine.Ports.RateLimit behaviour (Pristine v0.4.0)

Copy Markdown View Source

Rate limit boundary.

Summary

Callbacks

Clear any stored limiter state.

Resolve a limiter for a key.

Set a limiter backoff window in milliseconds.

Block until the limiter allows the operation.

Callbacks

clear(term)

(optional)
@callback clear(term()) :: :ok

Clear any stored limiter state.

for_key(term, keyword)

(optional)
@callback for_key(term(), keyword()) :: term()

Resolve a limiter for a key.

set(term, non_neg_integer, keyword)

(optional)
@callback set(term(), non_neg_integer(), keyword()) :: :ok

Set a limiter backoff window in milliseconds.

wait(term, keyword)

(optional)
@callback wait(term(), keyword()) :: :ok

Block until the limiter allows the operation.

within_limit(function, keyword)

@callback within_limit((-> term()), keyword()) :: term()