Beethoven.RoleMgmt.Manager (Beethoven v0.3.9)

Dynamic supervisor that manages the specialized role PIDs.

Public API

  • add_role/3 Adds a role to the Manager Dynamic Supervisor. Stores role name + PID in ETS.
  • remove_role/1 Removes a hosted role from the Dynamic Supervisor.

The use of ETS is just for tracking atomic role names to PIDs. It has no awareness of the cluster level allocations for this role.

Summary

Functions

Adds a role to the Elixir.Beethoven.RoleMgmt.Manager Dynamic Supervisor. Adds the pid + roleName to ETS for tracking. If the role already exists, :ok will still be returned.

Returns a specification to start this module under a supervisor.

Removes the role from the Elixir.Beethoven.RoleMgmt.ManagerDynamic Supervisor.

Supervisor Entry point.

Functions

add_role(roleName, roleModule, args)

@spec add_role(atom(), module(), any()) :: :ok

Adds a role to the Elixir.Beethoven.RoleMgmt.Manager Dynamic Supervisor. Adds the pid + roleName to ETS for tracking. If the role already exists, :ok will still be returned.

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

remove_role(roleName)

@spec remove_role(atom()) :: :ok | {:error, :not_found}

Removes the role from the Elixir.Beethoven.RoleMgmt.ManagerDynamic Supervisor.

start_link(init_args \\ [])

@spec start_link(any()) :: GenServer.on_start()

Supervisor Entry point.