Poolder.FactoryPool behaviour (Poolder v0.1.10)

View Source

Dynamic pool of grouped processes with fast lookup by group or pid.

Usage examples

# Start a worker under group :http Poolder.FactoryPool.start_child(:http, {MyWorker, args})

# Synchronous call to specific pid Poolder.FactoryPool.call(pid, :ping)

# Async message to a specific pid Poolder.FactoryPool.cast(pid, :refresh)

# Broadcast to all workers in a group Poolder.FactoryPool.broadcast(:http, :reload)

# Count active workers in a group Poolder.FactoryPool.count(:http)

Summary

Callbacks

start_child(group, {})

@callback start_child(
  group :: atom(),
  {module(), args :: any()}
) :: {:ok, pid()} | {:error, any()}

terminate(pid)

@callback terminate(pid :: pid()) :: :ok | {:error, any()}

terminate_group(group)

@callback terminate_group(group :: atom()) :: :ok | {:error, any()}