Module epna_pool

Provides the core pool implementation.

Copyright © (C) Erlware, LLC.

Authors: Eric Merritt (ericbmerritt@gmail.com).

Description

Provides the core pool implementation.

Function Index

get_connection/1
get_connection/2
return_connection/2
start_link/5This function starts up a new pool and registers it by name.
stop/1

Function Details

get_connection/1

get_connection(Name::episcina:name()) -> {ok, episcina:connection()}

get_connection/2

get_connection(Name::episcina:name(), Timeout::non_neg_integer()) -> {ok, episcina:connection()}

return_connection/2

return_connection(Name::episcina:name(), C::episcina:connection()) -> ok

start_link/5

start_link(Name::episcina:name(), Size::non_neg_integer(), Timeout::non_neg_integer(), ConnectFun::episcina:connect_fun(), CloseFun::episcina:close_fun()) -> {ok, pid()} | {error, term()}

Name: The name of the pool
Size: The maximum size of the pool. After this no further connections will be created and callers will have to wait for a connection to be freed.
Timeout: The maximum amount of time a caller is allowed to keep a connection before that connection is closed and considered invalid.
ConnectFun: A function that takes no arguments but returns a connection. This is used to create new connections in the system
CloseFun: A function that takes a connection as an argument and returns ok. This is expected to close the connection gracefully.

This function starts up a new pool and registers it by name. That name will be used in future calls to interact with the pool.

stop/1

stop(Name::episcina:name()) -> ok


Generated by EDoc