Grouper.GroupLeader (Grouper v0.1.0) View Source

This implements a group leader capable of IO and storing group metadata.

A Grouper.GroupLeader forwards IO upstream, just like any other group_leader. In addition, it also allocates a ETS table for this group and registers it in a global ETS table.

Requests for configuration and naming functions (mediated by the Grouper.Data module) store information in this ETS table (among other places).

Link to this section Summary

Types

valid info terms

keyword options for init function

options to init function

IO request info term

keyword options for start function

options to start function

t()

state for Grouper.Leader

Functions

Returns a specification to start this module under a supervisor.

gets state data for a given group leader

gets original group leader for this process

Starts a Grouper.Leader process linked to the current process.

stops a group leader process

Link to this section Types

Specs

infos() :: io_request()

valid info terms

Specs

init_option() ::
  {:commandeer, boolean() | pid() | [pid()]}
  | {:leader, pid()}
  | {:parent, pid()}

keyword options for init function

Specs

init_options() :: [init_option()]

options to init function

Specs

io_request() :: {:io_request, pid(), any(), any()}

IO request info term

Specs

option() :: GenServer.option() | init_option()

keyword options for start function

Specs

options() :: [option()]

options to start function

Specs

t() :: %Grouper.GroupLeader{
  commandeered: [pid()],
  ets_table_id: atom(),
  group_leader: pid(),
  self: pid()
}

state for Grouper.Leader

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Specs

get_group_data(pid()) :: {:ok, t()}

gets state data for a given group leader

Specs

get_group_leader(pid()) :: pid()

gets original group leader for this process

Specs

start_link(options()) :: GenServer.on_start()

Starts a Grouper.Leader process linked to the current process.

This is typically used in a supervision tree.

In addition to the normal options accepted by GenServer.start_link/3, this also accepts the following options:

  • commandeer - during initialization, sets itself as group_leader for this process or list of processes instead of the calling process

  • leader - during initialization, sets this process as the group_leader to which it forwards IO requests

  • parent - this specifies the parent process, useful for testing and when not being started in a normal supervision tree

Link to this function

stop(glpid, reason \\ :normal)

View Source

Specs

stop(pid(), reason :: atom()) :: :ok

stops a group leader process