mogs v0.1.1 Mogs.Board behaviour

Link to this section Summary

Functions

Options

Board

  • :load_mode – Allowed values are :sync and :async. Sets wether the load/2 callback will be called during the board server initialization (:sync) or after initialization. Defaults to :sync.

Services

Those options allow to define the generated modules or services associated to a board module. If a module would be generated, the option sets both the module name and the process registration name.

Link to this section Types

Link to this type

board()

board() :: any()

Link to this section Functions

Link to this macro

__using__(opts)

(macro)

Options

Board

  • :load_mode – Allowed values are :sync and :async. Sets wether the load/2 callback will be called during the board server initialization (:sync) or after initialization. Defaults to :sync.

Services

Those options allow to define the generated modules or services associated to a board module. If a module would be generated, the option sets both the module name and the process registration name.

Setting an option to false or nil will disable the corresponding feature and no module will be generated during compilation and/or no process will be started nor registered during runtime.

  • :supervisor – The name for a generated Supervisor module that will supervise other components (such as registry, servers supervisor). Defaults to __MODULE__.Supervisor.
  • :registry – The registration name for the Registry of Mogs.Board.Server processes handling boards. Defaults to __MODULE__.Server.Registry.
  • :server_sup – The name for the generated DynamicSupervisor module that will supervise each Mogs.Board.Server server process. Defaults to __MODULE__.Server.DynamicSupervisor.
Link to this function

add_player(name_or_pid, player_id, data, pid)

Link to this function

read_state(name_or_pid, fun)

Link to this function

send_command(name_or_pid, command)

Link to this function

start_server(module, supervisor, id, opts)

Link to this function

track_player(name_or_pid, player_id, pid)

Link to this section Callbacks

Link to this callback

handle_add_player(board, player_id, data)

handle_add_player(board :: any(), player_id :: any(), data :: any()) ::
  {:ok, board :: any()} | {:error, reason :: any()}
Link to this callback

handle_player_timeout(board, player_id)

handle_player_timeout(board :: any(), player_id :: any()) ::
  {:ok, board :: any()} | {:stop, reason :: any()}
Link to this callback

handle_update(board)

handle_update(board :: any()) ::
  {:ok, board :: any()} | {:stop, reason :: any()}
Link to this callback

load(id, load_info)

load(id :: any(), load_info :: any()) ::
  {:ok, board :: any()} | {:error, reason :: any()}