Grains.GenGrain behaviour (Grains v1.3.0)
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.format_status/2
.
Callback implementation for GenServer.handle_continue/2
.
Callback implementation for GenServer.init/1
.
Get a list of the grain's predecessors.
Get a list of the grain's successors.
Link to this section Types
from()
Specs
from() :: atom()
reply()
Specs
reply() :: term()
return()
Specs
state()
Specs
state() :: term()
tag()
Specs
tag() :: term()
Link to this section Callbacks
Specs
handle_pull(from(), state()) :: {:reply, reply(), state()} | {:reply, reply(), state(), return()} | {:noreply, state()} | {:noreply, state(), return()}
Handle a pull by a grain.
When pulled by pull/0,1
, this callback is triggered. The grain directly reply with
a :reply
tuple, ignore the pull with :noreply
, or use push/1,2
and :noreply
.
See handle_pull/3
for handling pull_with_tag/1,2
.
Specs
handle_pull(from(), tag(), state()) :: {:reply, reply(), state()} | {:reply, reply(), state(), return()} | {:noreply, state()} | {:noreply, state(), return()}
Handle a tagged pull by a grain.
When pulled by pull_with_tag/1,2
, this callback is triggered. The grain
directly reply with a :reply
tuple, ignore the pull with :noreply
, or use
push/1,2
and :noreply
.
See handle_pull/2
for handling pull/0,1
.
Specs
Handle incoming data.
This callback is triggered when any grain pushes data to this grain, using either
push/1
or push/2
.
Link to this section Functions
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.
format_status(reason, list)
Callback implementation for GenServer.format_status/2
.
full_name(short_name)
handle_continue(term, state)
Callback implementation for GenServer.handle_continue/2
.
init(arg)
Callback implementation for GenServer.init/1
.
own_full_name()
own_name()
predecessors()
Get a list of the grain's predecessors.
Note that this can only be called from a grain process.
pull()
pull(pred)
pull_with_tag(tag)
pull_with_tag(pred, tag)
push(msg)
push(short_name, msg)
start_link(mod, bread, name, args, opts)
successors()
Get a list of the grain's successors.
Note that this can only be called from a grain process.