ExUtcp.Transports.Graphql.Pool (ex_utcp v0.2.8)

View Source

Manages a pool of GraphQL connections with lifecycle management.

Summary

Functions

Returns a specification to start this module under a supervisor.

Closes all connections.

Closes a specific connection.

Gets or creates a connection for the given provider.

Returns a connection to the pool.

Starts the connection pool.

Gets pool statistics.

Types

t()

@type t() :: %ExUtcp.Transports.Graphql.Pool{
  cleanup_interval: timeout(),
  connection_timeout: timeout(),
  connections: %{required(String.t()) => pid()},
  max_connections: non_neg_integer(),
  max_idle_time: timeout()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close_all_connections()

@spec close_all_connections() :: :ok

Closes all connections.

close_connection(pid)

@spec close_connection(pid()) :: :ok

Closes a specific connection.

get_connection(provider)

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

Gets or creates a connection for the given provider.

return_connection(pid)

@spec return_connection(pid()) :: :ok

Returns a connection to the pool.

start_link(opts \\ [])

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

Starts the connection pool.

stats()

@spec stats() :: map()

Gets pool statistics.