View Source GenRegistry.Behaviour behaviour (gen_registry v1.3.0)

GenRegistry.Behaviour defines the interface that a GenRegistry module should implement.

It is included to aid the development of replacement GenRegistry like implementations for special use cases or for testing.

Link to this section Summary

Link to this section Callbacks

@callback count(:ets.tab()) :: integer()
@callback lookup(:ets.tab(), GenRegistry.Types.id()) ::
  {:ok, pid()} | {:error, :not_found}
Link to this callback

lookup_or_start(server, id, args, timeout)

View Source
@callback lookup_or_start(
  GenServer.server(),
  GenRegistry.Types.id(),
  args :: [any()],
  timeout :: integer()
) :: {:ok, pid()} | {:error, any()}
Link to this callback

reduce(tab, any, function)

View Source
@callback reduce(:ets.tab(), any(), ({GenRegistry.Types.id(), pid()}, any() -> any())) ::
  any()
@callback sample(:ets.tab()) :: {GenRegistry.Types.id(), pid()} | nil
Link to this callback

start(server, id, args, timeout)

View Source
@callback start(
  GenServer.server(),
  GenRegistry.Types.id(),
  args :: [any()],
  timeout :: integer()
) :: {:ok, pid()} | {:error, {:already_started, pid()}} | {:error, any()}
@callback stop(GenServer.server(), GenRegistry.Types.id()) :: :ok | {:error, :not_found}
@callback to_list(:ets.tab()) :: [{GenRegistry.Types.id(), pid()}]