Grains.GenGrain behaviour (Grains v1.5.1)

Link to this section Summary

Callbacks

Handle a pull by a grain.

Handle a tagged pull by a grain.

Handle incoming data.

Functions

Returns a specification to start this module under a supervisor.

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

Specs

from() :: atom()

Specs

reply() :: term()

Specs

return() :: timeout() | :hibernate | {:continue, term()}

Specs

state() :: term()

Specs

tag() :: term()

Link to this section Callbacks

Link to this callback

handle_pull(from, state)

(optional)

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.

Link to this callback

handle_pull(from, tag, state)

(optional)

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.

Link to this callback

handle_push(term, from, state)

(optional)

Specs

handle_push(term(), from(), state()) ::
  {:noreply, state()} | {:noreply, state(), return()}

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

Link to this function

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

format_status(reason, list)

Callback implementation for GenServer.format_status/2.

Link to this function

full_name(short_name)

Link to this function

handle_continue(term, state)

Callback implementation for GenServer.handle_continue/2.

Callback implementation for GenServer.init/1.

Link to this function

own_full_name()

Get a list of the grain's predecessors.

Note that this can only be called from a grain process.

Link to this function

pull_with_tag(tag)

Link to this function

pull_with_tag(pred, tag)

Link to this function

push(short_name, msg)

Link to this function

start_link(mod, bread, name, args, opts)

Get a list of the grain's successors.

Note that this can only be called from a grain process.