herd v0.4.2 Herd.Pool View Source

Builds a connection pool manager for a given herd. The manager has a number of overrideable functions, including:

  • spec_for_node/1 - infers a child spec for a given node in the cluster
  • nodename/1 - generates an atom for a given node
  • poolname/1 - generates a {:via, Registry, {MyRegistry, name}} tuple for a given node
  • workerconfig/1 - generates the worker config only for a given node. Note that pool config is inferred from `Application.getenv(app, __MODULE)` by default which might be sufficient for configuring poolboy.

Use with:

defmodule MyHerdPool do
  use Herd.Pool, otp_app: :myapp, herd: :myherd
end

This will spawn a pool for each node in the cluster and register them against a registry named MyHerdPool.Registry. It also is responsible for handling node ups/downs from the clusters sporadic health check.

Link to this section Summary

Link to this section Functions

Link to this function handle_diff(pool, adds, removes) View Source
Link to this function terminate_node(pool, registry, node) View Source