Module type S.POOL

Connection pool

module IO : IO
module Client : Client
type t
val size : t -> int
val create : size:int -> Client.connection_spec -> t IO.t

Create a pool of size connections, using the given spec.

val close : t -> unit IO.t

Close all connections

val with_pool : size:int -> Client.connection_spec -> (t -> 'a IO.t) -> 'a IO.t

Create a pool of size connections, using the given spec, pass it to the callback, and then destroy it.

val with_connection : t -> (Client.connection -> 'a IO.t) -> 'a IO.t

Temporarily require a connection to perform some operation. The connection must not escape the scope of the callback