sbroker_drop_queue (sbroker v1.1.1)
Implements a head or tail drop queue.
sbroker_drop_queue
can be used as a sbroker_queue
module in a sbroker
or sregulator
. It will provide a FIFO or LIFO queue that drops the head or tail request from the queue when a maximum size is exceeded. Its argument, spec()
, is of the form: #{out => Out :: out | out_r, % default: out
drop => Drop :: drop | drop_r, % default: drop_r
max => Max :: non_neg_integer() | infinity} % default: infinity
Out
is either out
for a FIFO queue (the default) or out_r
for a LIFO queue. Drop
is either drop_r
for tail drop (the default) where the last request is droppped, or drop
for head drop, where the first request is dropped. Dropping occurs when queue is above the maximum size Max
(defaults to infinity
).
Link to this section Summary
Link to this section Types
Link to this type
spec/0
Specs
spec() :: #{out => Out :: out | out_r, drop => Drop :: drop | drop_r, max => Max :: non_neg_integer() | infinity}.