View Source shq (shq v0.0.4)
Link to this section Summary
Types
Queue options, either a map or proplist.
See gen_server:start/3,4, gen_server:start_link/3,4, gen_server:start_monitor/3,4.
See gen_server:call/3,4, gen_server:cast/2.
Functions
Drain the queue from the front.
Drain the queue from the rear.
Insert an item at the rear of a queue immediately.
Insert an item at the rear of a queue, waiting for the given timeout if the queue is full.
Insert an item at the front of a queue immediately.
Insert an item at the front of a queue, waiting for the given timeout if the queue is full.
Retrieve and remove an item from the front of a queue immediately.
Retrieve and remove an item from the front of a queue, waiting for the given timeout if the queue is empty.
Retrieve and remove an item from the rear of a queue immediately.
Retrieve and remove an item from the rear of a queue, waiting for the given timeout if the queue is empty.
Retrieve an item from the front of a queue without removing it.
Retrieve an item from the rear of a queue without removing it.
Get the number of items currently in a queue.
Start an non-linked anonymous queue.
Start an non-linked named queue.
Start an linked anonymous queue.
Start an linked named queue.
Start an monitored anonymous queue.
Start an monitored named queue.
Stop a queue. All remaining items will be discarded.
Link to this section Types
Specs
Queue options, either a map or proplist.Specs
opts_list() :: [{max, non_neg_integer() | infinity}].
Specs
opts_map() :: #{max => non_neg_integer() | infinity}.
Specs
server_name() :: {local, Name :: atom()} | {global, GlobalName :: term()} | {via, Via :: module(), ViaName :: term()}.
Specs
server_ref() :: pid() | (Name :: atom()) | {Name :: atom(), Node :: node()} | {global, GlobalName :: term()} | {via, Via :: module(), ViaName :: term()}.
Link to this section Functions
Specs
close(ServerRef :: server_ref()) -> ok.
open/1
.
Specs
drain(ServerRef :: server_ref()) -> [Item :: term()].
Specs
drain_r(ServerRef :: server_ref()) -> [Item :: term()].
Specs
in(ServerRef :: server_ref(), Item :: term()) -> ok | full | closed.
Specs
in(ServerRef :: server_ref(), Item :: term(), Timeout :: timeout()) -> ok | full | closed.
Specs
in_r(ServerRef :: server_ref(), Item :: term()) -> ok | full | closed.
Specs
in_r(ServerRef :: server_ref(), Item :: term(), Timeout :: timeout()) -> ok | full | closed.
Specs
open(ServerRef :: server_ref()) -> ok.
Specs
out(ServerRef :: server_ref()) -> {ok, Item :: term()} | empty.
Specs
out(ServerRef :: server_ref(), Timeout :: timeout()) -> {ok, Item :: term()} | empty.
Specs
out_r(ServerRef :: server_ref()) -> {ok, Item :: term()} | empty.
Specs
out_r(ServerRef :: server_ref(), Timeout :: timeout()) -> {ok, Item :: term()} | empty.
Specs
peek(ServerRef :: server_ref()) -> {ok, Item :: term()} | empty.
Specs
peek_r(ServerRef :: server_ref()) -> {ok, Item :: term()} | empty.
Specs
size(ServerRef :: server_ref()) -> Size :: non_neg_integer().
Specs
start(Opts :: opts()) -> {ok, pid()}.
Specs
start(ServerName :: server_name(), Opts :: opts()) -> {ok, pid()} | {error, Reason :: already_started}.
Specs
start_link(Opts :: opts()) -> {ok, pid()}.
Specs
start_link(ServerName :: server_name(), Opts :: opts()) -> {ok, pid()} | {error, Reason :: already_started}.
Specs
start_monitor(Opts :: opts()) -> {ok, {pid(), reference()}}.
Specs
start_monitor(ServerName :: server_name(), Opts :: opts()) -> {ok, {pid(), reference()}} | {error, Reason :: already_started}.
Specs
status(ServerRef :: server_ref()) -> open | closed.
open
or closed
.
Specs
stop(ServerRef :: server_ref()) -> ok.