jhn_elixir v0.1.2 JhnElixir.GenServer behaviour

Link to this section Summary

Link to this section Types

Link to this type

debug()

debug() :: [:trace | :log | :statistics | {:log_to_file, Path.t()}]
Link to this type

from()

from() :: {pid(), tag :: term()}
Link to this type

link()

link() :: :link | :nolink
Link to this type

name()

name() :: atom() | {:global, term()} | {:via, module(), term()}
Link to this type

on_start()

on_start() ::
  {:ok, pid()} | :ignore | {:error, {:already_started, pid()} | term()}
Link to this type

option()

option() ::
  {:name, name()}
  | {:link, link()}
  | {:debug, debug()}
  | {:timeout, timeout()}
  | {:spawn_opt, Process.spawn_opt()}
  | {:hibernate_after, timeout()}
Link to this type

options()

options() :: [option()]
Link to this type

server()

server() :: pid() | name() | {atom(), node()}

Link to this section Functions

Link to this function

abcast(nodes \\ [node() | Node.list()], name, message)

abcast([node()], name :: atom(), term()) :: :abcast
Link to this function

call(server, request, timeout \\ 5000)

call(server(), term(), timeout()) :: term()
Link to this function

cast(server, message)

cast(server(), term()) :: :ok
Link to this function

multi_call(nodes \\ [node() | Node.list()], name, req, timeout \\ :infinity)

multi_call([node()], name :: atom(), term(), timeout()) ::
  {replies :: [{node(), term()}], bad_nodes :: [node()]}
Link to this function

reply(from, reply)

reply(from(), term()) :: :ok
Link to this function

start(module, init_arg, options \\ [])

start(module(), any(), options()) :: on_start()
Link to this function

stop(server, reason \\ :normal, timeout \\ :infinity)

stop(server(), reason :: term(), timeout()) :: :ok

Link to this section Callbacks

Link to this callback

code_change(old_vsn, state, extra)

(optional)
code_change(old_vsn, state :: term(), extra :: term()) ::
  {:ok, new_state :: term()} | {:error, reason :: term()}
when old_vsn: term() | {:down, term()}
Link to this callback

format_status(reason, pdict_and_state)

(optional)
format_status(reason, pdict_and_state :: list()) :: term()
when reason: :normal | :terminate
Link to this callback

handle_call(request, from, state)

(optional)
handle_call(request :: term(), from(), state :: term()) ::
  {:reply, reply, new_state}
  | {:reply, reply, new_state, timeout() | :hibernate | {:continue, term()}}
  | {:noreply, new_state}
  | {:noreply, new_state, timeout() | :hibernate | {:continue, term()}}
  | {:stop, reason, reply, new_state}
  | {:stop, reason, new_state}
when reply: term(), new_state: term(), reason: term()
Link to this callback

handle_cast(request, state)

(optional)
handle_cast(request :: term(), state :: term()) ::
  {:noreply, new_state}
  | {:noreply, new_state, timeout() | :hibernate | {:continue, term()}}
  | {:stop, reason :: term(), new_state}
when new_state: term()
Link to this callback

handle_continue(continue, state)

(optional)
handle_continue(continue :: term(), state :: term()) ::
  {:noreply, new_state}
  | {:noreply, new_state, timeout() | :hibernate | {:continue, term()}}
  | {:stop, reason :: term(), new_state}
when new_state: term()
Link to this callback

handle_info(msg, state)

(optional)
handle_info(msg :: :timeout | term(), state :: term()) ::
  {:noreply, new_state}
  | {:noreply, new_state, timeout() | :hibernate | {:continue, term()}}
  | {:stop, reason :: term(), new_state}
when new_state: term()
Link to this callback

init(init_arg)

init(init_arg :: term()) ::
  {:ok, state}
  | {:ok, state, timeout() | :hibernate | {:continue, term()}}
  | :ignore
  | {:stop, reason :: any()}
when state: any()
Link to this callback

terminate(reason, state)

(optional)
terminate(reason, state :: term()) :: term()
when reason: :normal | :shutdown | {:shutdown, term()} | term()