ExUtcp.Transports.TcpUdp.PoolBehaviour behaviour (ex_utcp v0.3.2)

Copy Markdown View Source

Behaviour for TCP/UDP connection pools to enable mocking in tests.

Summary

Callbacks

close_all_connections(pool_pid)

@callback close_all_connections(pool_pid :: pid()) :: :ok | {:error, term()}

close_connection(pool_pid, conn_pid)

@callback close_connection(pool_pid :: pid(), conn_pid :: pid()) :: :ok | {:error, term()}

get_connection(pool_pid, provider)

@callback get_connection(pool_pid :: pid(), provider :: map()) ::
  {:ok, pid()} | {:error, term()}

start_link(opts)

@callback start_link(opts :: keyword()) :: {:ok, pid()} | {:error, term()}

stats(pool_pid)

@callback stats(pool_pid :: pid()) :: map()