Search documentation of macula

# macula_peer_connection_pool (macula v0.44.2)

View Source

Peer Connection Pool - Reuses QUIC connections to remote peers.

Stores one QUIC connection per endpoint. Callers open fresh streams on the reused connection (QUIC multiplexing). Connections are health-checked, LRU-evicted, and cleaned up on idle timeout.

# Summary

## Functions

get_connected_peers()

Get list of peer endpoints with active connections.

get_connection(Endpoint)

Get a connection to an endpoint. Returns the QUIC connection handle. Caller must open their own stream via macula_quic:open_stream(Conn).

handle_call(Request, From, State)
handle_cast(Msg, State)
handle_info(Info, State)
init(Opts)
invalidate(Endpoint)

Invalidate and close a pooled connection.

put(PeerId, Connection)

Put a connection directly (NAT system API).

return_connection(Endpoint, Connection)

Return a connection to the pool (store/update).

start_link()
start_link(Opts)
stats()

Get pool statistics.

terminate(Reason, State)

# Functions

# get_connected_peers()

    -spec get_connected_peers() -> [binary()].

Get list of peer endpoints with active connections.

# get_connection(Endpoint)

    -spec get_connection(binary()) -> {ok, term()} | {error, term()}.

Get a connection to an endpoint. Returns the QUIC connection handle. Caller must open their own stream via macula_quic:open_stream(Conn).

# handle_call(Request, From, State)

# handle_cast(Msg, State)

# handle_info(Info, State)

# init(Opts)

# invalidate(Endpoint)

    -spec invalidate(binary()) -> ok.

Invalidate and close a pooled connection.

# put(PeerId, Connection)

    -spec put(binary(), term()) -> ok.

Put a connection directly (NAT system API).

# return_connection(Endpoint, Connection)

    -spec return_connection(binary(), term()) -> ok.

Return a connection to the pool (store/update).

# start_link()

# start_link(Opts)

# stats()

    -spec stats() -> map().

Get pool statistics.

# terminate(Reason, State)