Behaviours: sbroker_fair_queue, sbroker_queue.
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
).
spec() = #{out => Out::out | out_r, drop => Drop::drop | drop_r, max => Max::non_neg_integer() | infinity}
Generated by EDoc