View Source shq (shq v0.1.1)
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
-type opts_list() :: [{max, non_neg_integer() | infinity}].
-type opts_map() :: #{max => non_neg_integer() | infinity}.
-type server_name() ::
{local, Name :: atom()} |
{global, GlobalName :: term()} |
{via, Via :: module(), ViaName :: term()}.
-type server_ref() ::
pid() |
(Name :: atom()) |
{Name :: atom(), Node :: node()} |
{global, GlobalName :: term()} |
{via, Via :: module(), ViaName :: term()}.
Link to this section Functions
-spec close(ServerRef :: server_ref()) -> ok.
open/1
.
-spec drain(ServerRef :: server_ref()) -> [Item :: term()].
-spec drain_r(ServerRef :: server_ref()) -> [Item :: term()].
-spec in(ServerRef :: server_ref(), Item :: term()) -> ok | full | closed.
-spec in(ServerRef :: server_ref(), Item :: term(), Timeout :: timeout()) -> ok | full | closed.
-spec in_r(ServerRef :: server_ref(), Item :: term()) -> ok | full | closed.
-spec in_r(ServerRef :: server_ref(), Item :: term(), Timeout :: timeout()) -> ok | full | closed.
-spec open(ServerRef :: server_ref()) -> ok.
-spec out(ServerRef :: server_ref()) -> {ok, Item :: term()} | empty.
-spec out(ServerRef :: server_ref(), Timeout :: timeout()) -> {ok, Item :: term()} | empty.
-spec out_r(ServerRef :: server_ref()) -> {ok, Item :: term()} | empty.
-spec out_r(ServerRef :: server_ref(), Timeout :: timeout()) -> {ok, Item :: term()} | empty.
-spec peek(ServerRef :: server_ref()) -> {ok, Item :: term()} | empty.
-spec peek_r(ServerRef :: server_ref()) -> {ok, Item :: term()} | empty.
-spec size(ServerRef :: server_ref()) -> Size :: non_neg_integer().
-spec start(Opts :: opts()) -> {ok, pid()}.
-spec start(ServerName :: server_name(), Opts :: opts()) -> {ok, pid()} | {error, Reason :: already_started}.
-spec start_link(Opts :: opts()) -> {ok, pid()}.
-spec start_link(ServerName :: server_name(), Opts :: opts()) -> {ok, pid()} | {error, Reason :: already_started}.
-spec start_monitor(Opts :: opts()) -> {ok, {pid(), reference()}}.
-spec start_monitor(ServerName :: server_name(), Opts :: opts()) -> {ok, {pid(), reference()}} | {error, Reason :: already_started}.
-spec status(ServerRef :: server_ref()) -> open | closed.
open
or closed
.
-spec stop(ServerRef :: server_ref()) -> ok.