DGen.Server behaviour (DGen v0.3.0)

Copy Markdown View Source

Summary

Callbacks

handle_call(request, from, state)

(optional)
@callback handle_call(request :: term(), from :: term(), state :: term()) ::
  {:reply, reply :: term(), new_state :: term()}
  | {:noreply, new_state :: term()}

handle_call_tx(tx_ctx, request, from, state)

(optional)
@callback handle_call_tx(
  tx_ctx :: map(),
  request :: term(),
  from :: term(),
  state :: term()
) ::
  {:reply, reply :: term(), new_state :: term()}
  | {:noreply, new_state :: term()}

handle_cast(msg, state)

(optional)
@callback handle_cast(msg :: term(), state :: term()) :: {:noreply, new_state :: term()}

handle_cast_tx(tx_ctx, msg, state)

(optional)
@callback handle_cast_tx(tx_ctx :: map(), msg :: term(), state :: term()) ::
  {:noreply, new_state :: term()}

handle_info(info, state)

(optional)
@callback handle_info(info :: term(), state :: term()) :: {:noreply, new_state :: term()}

handle_info_tx(tx_ctx, info, state)

(optional)
@callback handle_info_tx(tx_ctx :: map(), info :: term(), state :: term()) ::
  {:noreply, new_state :: term()}

handle_locked(db_ctx, event_type, msg, state)

(optional)
@callback handle_locked(
  db_ctx :: map(),
  event_type :: term(),
  msg :: term(),
  state :: term()
) ::
  {:reply, reply :: term(), new_state :: term()}
  | {:noreply, new_state :: term()}

init(args)

@callback init(args :: term()) ::
  {:ok, state :: term()}
  | {:ok, tuid :: tuple(), state :: term()}
  | {:error, reason :: term()}

Functions

call(server, msg)

See :dgen_server.call/2.

call(server, msg, timeout)

See :dgen_server.call/3.

cast(server, msg)

See :dgen_server.cast/2.

cast_k(server, msg)

See :dgen_server.cast_k/2.

kill(server, reason)

See :dgen_server.kill/2.

outbox_cast(server)

See :dgen_server.outbox_cast/1.

outbox_cast(server, timeout)

See :dgen_server.outbox_cast/2.

priority_call(server, msg)

See :dgen_server.priority_call/2.

priority_call(server, msg, timeout)

See :dgen_server.priority_call/3.

priority_cast(server, msg)

See :dgen_server.priority_cast/2.

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

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