View Source opuntia_srv (opuntia v1.1.0)
Summary
Types
This accepts a function that generates the shape, if such shape was too expensive to calculate. Note that for this server, only full buckets and in milliseconds are valid, due to the nature of gen_server call timeouts.
Functions
Shapes the caller from executing the action, asynchronously
Ask server to forget all its shapers
Start-links a shaper server
Shapes the caller from executing the action
Types
-type args() :: #{max_delay => opuntia:delay(), cleanup_interval => seconds(), ttl => seconds()}.
-type key() :: term().
-type name() :: atom().
-type opuntia_state() :: #opuntia_state{}.
-type seconds() :: non_neg_integer().
-type shape() :: 0 | #{bucket_size := opuntia:bucket_size(), rate := opuntia:rate(), time_unit := millisecond, start_full := true}.
Functions
-spec request_wait(gen_server:server_ref(), key(), opuntia:tokens(), gen_shape()) -> gen_server:request_id().
Shapes the caller from executing the action, asynchronously
This will do agen_server:send_request/2
. Usual pattern applies to receive the matching continue.
-spec wait(gen_server:server_ref(), key(), opuntia:tokens(), gen_shape()) -> continue | {error, max_delay_reached}.
Shapes the caller from executing the action
This will do an actual blockinggen_server:call/3
.