Sprites.ControlPool (Sprites v0.1.0)

View Source

Pool of Sprites.ControlConn processes for a single sprite.

Manages connection lifecycle with checkout/checkin semantics and automatic draining when the pool grows too large.

Summary

Functions

Returns a connection to the pool.

Checks out a control connection from the pool.

Returns a specification to start this module under a supervisor.

Closes all connections in the pool and stops the GenServer.

Starts a control pool (unlinked) for the given sprite.

Starts a control pool for the given sprite.

Functions

checkin(pid, conn_pid)

@spec checkin(pid(), pid()) :: :ok

Returns a connection to the pool.

checkout(pid)

@spec checkout(pid()) :: {:ok, pid()} | {:error, term()}

Checks out a control connection from the pool.

Returns an idle connection or creates a new one. Returns {:error, {:control_not_supported, 404}} if the server doesn't support control mode.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close(pid)

@spec close(pid()) :: :ok

Closes all connections in the pool and stops the GenServer.

start(opts)

@spec start(keyword()) :: GenServer.on_start()

Starts a control pool (unlinked) for the given sprite.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts a control pool for the given sprite.