Copyright © Fred Hebert, Geoff Cant
Behaviours: gen_statem.
Authors: Fred Hebert (mononcqc@ferd.ca), Geoff Cant (nem@erlang.geek.nz), Eric des Courtis (eric.descourtis@mitel.com).
drop() = non_neg_integer()
filter() = fun((Msg::term(), State::term()) -> {{ok, NewMsg::term()} | drop, State::term()} | skip)
in() = {post, Msg::term()}
mail() = {mail, Self::pid(), Msgs::list(), Count::non_neg_integer(), Lost::drop()}
max() = pos_integer()
name() = {local, atom()} | {global, term()} | atom() | pid() | {via, module(), term()}
note() = {mail, Self::pid(), new_data}
| active/3 | Forces the buffer into an active state where it will send the data it has accumulated. |
| callback_mode/0 | |
| give_away/3 | Give away the PO Box ownership to another process. |
| give_away/4 | Give away the PO Box ownership to another process. |
| notify/1 | Forces the buffer into its notify state, where it will send a single message alerting the Owner of new messages before going back to the passive state. |
| post/2 | Sends a message to the PO Box, to be buffered. |
| post_sync/2 | Sends a message to the PO Box, to be buffered. |
| post_sync/3 | |
| resize/2 | Allows to take a given buffer, and make it larger or smaller. |
| resize/3 | Allows to take a given buffer, and make it larger or smaller. |
| start_link/1 | |
| start_link/2 | |
| start_link/3 | Starts a new buffer process. |
| start_link/4 | |
| start_link/5 | |
| usage/1 | Get the number of items in the PO Box and the capacity. |
| usage/2 | Get the number of items in the PO Box and the capacity. |
Forces the buffer into an active state where it will
send the data it has accumulated. The fun passed needs to have
two arguments: A message, and a term for state. The function can return,
for each element, a tuple of the form {Res, NewState}, where Res can be:
- {ok, Msg} to receive the message in the block that gets shipped
- drop to ignore the message
- skip to stop removing elements from the stack, and keep them for later.
callback_mode() -> any()
Give away the PO Box ownership to another process. This will send a message in the following form to Dest: {pobox_transfer, BoxPid :: pid(), PreviousOwnerPid :: pid(), undefined, give_away}
Give away the PO Box ownership to another process. This will send a message in the following form to Dest: {pobox_transfer, BoxPid :: pid(), PreviousOwnerPid :: pid(), DestData :: term(), give_away}
notify(Box::name()) -> ok
Forces the buffer into its notify state, where it will send a single message alerting the Owner of new messages before going back to the passive state.
post(Box::name(), Msg::term()) -> ok
Sends a message to the PO Box, to be buffered.
post_sync(Box::name(), Msg::term()) -> ok | full
Sends a message to the PO Box, to be buffered. But give additional feedback about if PO Box is full. This is very useful when combined with the keep_old buffer type because it tells you the message will be dropped.
post_sync(Box::name(), Msg::term(), Timeout::timeout()) -> ok | full
Allows to take a given buffer, and make it larger or smaller. A buffer can be made larger without overhead, but it may take more work to make it smaller given there could be a need to drop messages that would now be considered overflow.
Allows to take a given buffer, and make it larger or smaller. A buffer can be made larger without overhead, but it may take more work to make it smaller given there could be a need to drop messages that would now be considered overflow.
start_link(Opts::map() | list()) -> {ok, pid()}
start_link(Name::name(), Opts::map() | list()) -> {ok, pid()}
start_link(Owner::name(), MaxSize::max(), Type::stack | queue | keep_old | {mod, module()}) -> {ok, pid()}
Starts a new buffer process. The implementation can either be a stack or a queue, depending on which messages will be dropped (older ones or newer ones). Note that stack buffers do not guarantee message ordering. The initial state can be either passive or notify, depending on whether the user wants to get notifications of new messages as soon as possible.
start_link(Owner::name(), MaxSize::max(), Type::stack | queue | keep_old | {mod, module()}, StateName::notify | passive) -> {ok, pid()}
start_link(Name::name(), Owner::name(), MaxSize::max(), Type::stack | queue | keep_old | {mod, module()}, StateName::notify | passive) -> {ok, pid()}
usage(Box::name()) -> {non_neg_integer(), pos_integer()}
Get the number of items in the PO Box and the capacity.
usage(Box::name(), Timeout::timeout()) -> {non_neg_integer(), pos_integer()}
Get the number of items in the PO Box and the capacity.
Generated by EDoc