Rowtype_sqlite.PoolConnections made up front to one file and lent one at a time.
val create :
sw:Eio.Switch.t ->
mono_clock:_ Eio.Time.Mono.t ->
?timeout:Mtime.Span.t ->
?size:int ->
?wait:Mtime.Span.t ->
?observe:observer ->
string ->
(t, [> Rowtype.error ]) Stdlib.resultsize connections, 8 unless given and at least one, each as connect makes it, timeout and observe passed through; the first that cannot be made is the answer, and those made before it are closed. wait is how long a borrow waits for one, 5 s unless given. A database in memory, ":memory:" or "", is refused, since each connection would have one of its own: a pool is of a file. Readers alongside a writer want the file in WAL mode, pragma journal_mode = wal, which the file keeps.
What a borrow meets in the pool, a state of the pool's own.
Borrow a connection, run f on it on the calling fiber, and give it back, even if f raises: `Pool `Busy if none came free within the wait, and `Pool `Closed at once if the pool is closed, or closes while the borrow waits. A connection is given back with no transaction open: one a borrower left open is rolled back, and one whose rollback fails is an error line on rowtype-sqlite, closed and made again.
val close : t -> unitClose the idle connections now and each borrowed one as it is given back. A borrow waiting, and every one after, is `Pool `Closed.