Snakepit.Pool (snakepit v0.4.1)

Pool manager for external workers with concurrent initialization.

Features:

  • Concurrent worker startup (all workers start in parallel)
  • Simple queue-based request distribution
  • Non-blocking async execution
  • Automatic request queueing when workers are busy
  • Adapter-based support for any external process

Summary

Functions

Waits for the pool to be fully initialized.

Returns a specification to start this module under a supervisor.

Executes a command on any available worker.

Execute a streaming command with callback.

Gets pool statistics.

Lists all worker IDs in the pool.

Starts the pool manager.

Functions

await_ready(pool \\ __MODULE__, timeout \\ 15000)

@spec await_ready(atom() | pid(), timeout()) :: :ok | {:error, :timeout}

Waits for the pool to be fully initialized.

Returns :ok when all workers are ready, or {:error, :timeout} if the pool doesn't initialize within the given timeout.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

execute(command, args, opts \\ [])

Executes a command on any available worker.

execute_stream(command, args, callback_fn, opts \\ [])

Execute a streaming command with callback.

get_stats(pool \\ __MODULE__)

Gets pool statistics.

list_workers(pool \\ __MODULE__)

Lists all worker IDs in the pool.

start_link(opts \\ [])

Starts the pool manager.