Noizu.Service.Worker.Behaviour behaviour (NoizuLabs Services v0.1.2)

Summary

Types

@type context() :: term()
@type info() :: atom() | term()
Link to this type

noreply_response()

@type noreply_response() :: {:noreply, state()} | {:noreply, state(), term()}
@type options() :: term() | Map.t() | nil
@type ref() :: {:ref, module(), term()} | worker_identifier()
Link to this type

reply_response(response)

@type reply_response(response) ::
  {:reply, response, state()} | {:reply, response, state(), term()}
Link to this type

response_struct(type)

@type response_struct(type) :: {:ok, type} | {:error, term()}
Link to this type

response_tuple()

@type response_tuple() :: {:ok, term()} | {:error, term()}
@type state() :: Noizu.Service.Worker.State.t()
@type worker() :: any()
Link to this type

worker_identifier()

@type worker_identifier() :: term()

Callbacks

Link to this callback

__dispatcher__()

@callback __dispatcher__() :: module()
@callback __pool__() :: module()
@callback __registry__() :: module()
Link to this callback

crash!(state, context, options)

@callback crash!(state(), context(), options()) :: noreply_response()
Link to this callback

fetch(state, value, context, options)

@callback fetch(state(), value :: term(), context(), options()) :: reply_response(any())
Link to this callback

hibernate(state, context, options)

@callback hibernate(state(), context(), options()) :: noreply_response()
Link to this callback

init(ref, term, term)

@callback init(ref(), term(), term()) :: state()
Link to this callback

kill!(state, context, options)

@callback kill!(state(), context(), options()) :: noreply_response()
Link to this callback

load(state, context, options)

@callback load(state(), context(), options()) :: response_struct(state())
Link to this callback

persist!(state, context, options)

@callback persist!(state(), context(), options()) ::
  reply_response({:ok, state()} | {:ok, term()} | {:error, term()})
Link to this callback

ping(state, context, options)

@callback ping(state(), context(), options()) :: reply_response({:pong, pid()})
Link to this callback

recipient(term)

@callback recipient(term()) :: response_tuple()
Link to this callback

reload!(state, context, options)

@callback reload!(state(), context(), options()) :: reply_response(state() | any())
Link to this callback

wake!(state, context, options)

@callback wake!(state(), context(), options()) :: reply_response({:pong, pid()})

Functions

Link to this function

handle_call(m, call, from, state)

Link to this function

handle_cast(m, call, state)

Link to this function

handle_info(m, call, state)

Link to this function

persist(m, worker, context, options)

Link to this function

persist_changes(m, state, context, options \\ nil)

Link to this function

shallow_persist(m, worker, context, options)