jhn_elixir v0.1.7 JhnElixir.GenEvent 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

handler()

handler() :: module() | {module(), term()}
Link to this type

link()

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

manager()

manager() :: pid() | name() | {atom(), node()}
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 section Functions

Link to this function

add_handler(manager, handler, args)

add_handler(manager(), handler(), term()) :: term()
Link to this function

add_sup_handler(manager, handler, args)

add_sup_handler(manager(), handler(), term()) :: term()
Link to this function

call(manager, handler, request, timeout \\ 5000)

call(manager(), handler(), term(), timeout()) :: term()
Link to this function

delete_handler(manager, handler, args)

delete_handler(manager(), handler(), term()) :: term()
Link to this function

notify(manager, event)

notify(manager(), term()) :: :ok
Link to this function

start(options \\ [])

start(options()) :: on_start()
Link to this function

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

stop(manager(), reason :: term(), timeout()) :: :ok
Link to this function

swap_handler(manager, arg1, arg2)

swap_handler(manager(), {handler(), term()}, {handler(), term()}) :: term()
Link to this function

swap_sup_handler(manager, arg1, arg2)

swap_sup_handler(manager(), {handler(), term()}, {handler(), term()}) :: term()
Link to this function

sync_notify(manager, event)

sync_notify(manager(), term()) :: :ok
Link to this function

which_handlers(manager)

which_handlers(manager()) :: [handler()]

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, state)

(optional)
handle_call(request :: term(), state :: term()) ::
  {:ok, reply, new_state}
  | {:ok, reply, new_state, :hibernate}
  | {:swap_handler, reply, args1, new_state, handler2, args2}
  | {:remove_handler, reply}
when reply: term(),
     new_state: term(),
     args1: term(),
     args2: term(),
     handler2: term()
Link to this callback

handle_event(event, state)

(optional)
handle_event(event :: term(), state :: term()) ::
  {:ok, new_state}
  | {:ok, new_state, :hibernate}
  | {:swap_handler, args1, new_state, handler2, args2}
  | :remove_handler
when new_state: term(), args1: term(), args2: term(), handler2: term()
Link to this callback

handle_info(info, state)

(optional)
handle_info(info :: term(), state :: term()) ::
  {:ok, new_state}
  | {:ok, new_state, :hibernate}
  | {:swap_handler, args1, new_state, handler2, args2}
  | :remove_handler
when new_state: term(), args1: term(), args2: term(), handler2: term()
Link to this callback

init(init_arg)

init(init_arg :: term()) ::
  {:ok, state} | {:ok, state, :hibernate} | {:error, term()}
when state: term()
Link to this callback

terminate(reason, state)

(optional)
terminate(reason :: term(), state :: term()) :: term()