macula_connection_pool (macula v0.20.5)

View Source

Connection pool manager for endpoint connections.

Manages a pool of QUIC connections to remote endpoints, providing connection caching and reuse to avoid connection overhead for multi-endpoint RPC operations.

Connection pool structure: #{Endpoint => #{connection => Conn, stream => Stream, last_used => Timestamp}}

Summary

Functions

Close all connections in the pool.

Create a new connection to an endpoint.

Get or create a connection to an endpoint. Returns {ok, Conn, Stream, UpdatedPool} or {error, Reason, Pool}.

Functions

close_all_connections(Pool)

-spec close_all_connections(map()) -> ok.

Close all connections in the pool.

create_connection(Endpoint, NodeId, RealmId, Pool)

-spec create_connection(binary(), binary(), binary(), map()) ->
                           {ok, pid(), pid(), map()} | {error, term(), map()}.

Create a new connection to an endpoint.

get_or_create_connection(Endpoint, NodeId, RealmId, Pool)

-spec get_or_create_connection(binary(), binary(), binary(), map()) ->
                                  {ok, pid(), pid(), map()} | {error, term(), map()}.

Get or create a connection to an endpoint. Returns {ok, Conn, Stream, UpdatedPool} or {error, Reason, Pool}.