ExPool v0.0.1 ExPool

The main ExPool interface, allowing for pool creation/termination and task submission.

Summary

Functions

Creates a new set of N Processes, adding them to a HashDict so they can be referenced at a later time. Processes various options using ExPool.Options.parse/1, and potentially binds the pool to a name via Agent

Retrieves a registered pool by name. If none is found, Agent will raise an error, so we don’t have to care explicitly

Submits a task to a pool, either provided or by name. Returns error tuples if the pool is either inactive or invalid. If valid, a pid will be chosen based on the selection methods of the pool, and the task will be forwarded

Terminates all processes inside a pool, either provided or by name. Returns a pool marked as inactive to avoid developers sending uncaught messages through the pipeline

Functions

create_pool(num, opts \\ [])

Creates a new set of N Processes, adding them to a HashDict so they can be referenced at a later time. Processes various options using ExPool.Options.parse/1, and potentially binds the pool to a name via Agent.

get_pool(id)

Retrieves a registered pool by name. If none is found, Agent will raise an error, so we don’t have to care explicitly.

submit(pool, func)

Submits a task to a pool, either provided or by name. Returns error tuples if the pool is either inactive or invalid. If valid, a pid will be chosen based on the selection methods of the pool, and the task will be forwarded.

If there is a name registered, the Agent will have the state updated when appropriate, to reflect any changes inside the pool.

terminate(pool)

Terminates all processes inside a pool, either provided or by name. Returns a pool marked as inactive to avoid developers sending uncaught messages through the pipeline.