Module Rowtype_postgres.Pool

Connections made up front and lent one at a time, as Postgres_eio.Pool lends them.

type t
val create : sw:Eio.Switch.t -> net:_ Eio.Net.t -> mono_clock:_ Eio.Time.Mono.t -> ?parameters:(string * string) list -> ?timeout:Mtime.Span.t -> ?statement_cache:int -> ?size:int -> ?wait:Mtime.Span.t -> ?reset:bool -> ?max_lifetime:Mtime.Span.t -> ?idle_check:Mtime.Span.t -> ?observe:observer -> Conninfo.t -> (t, [> Rowtype.error ]) Stdlib.result

As Postgres_eio.Pool.create, every option passed through; observe is connect's, for every connection it lends.

type error = [
  1. | `Pool of [ `Busy | `Closed ]
]

What a borrow meets in the pool, a state of the pool's own.

val use : ?wait:Mtime.Span.t -> t -> (conn -> 'a) -> ('a, [> error ]) Stdlib.result

As Postgres_eio.Pool.use: `Pool `Busy if no connection came free within the wait, and `Pool `Closed at once if the pool is closed, or closes while the borrow waits.

type stats = Postgres_eio.Pool.stats = {
  1. size : int;
  2. idle : int;
  3. waiting : int;
  4. replaced : int;
}
val stats : t -> stats

As Postgres_eio.Pool.stats.

val close : t -> unit

As Postgres_eio.Pool.close.