The next Caqti release is almost ready if I proceed as planned, though I would like to lift plans in advance in case anyone has feedback.
While Caqti 2 brought support for MirageOS (using PGX), it is missing TLS, which limits its usability in practise. Patching that hole will be the main delivery for the upcoming release. This involved a revision of the network abstraction and better performance under EIO.
Some more minor changes can be seen in the preliminary change log.
Minor Breaking Changes
My plan is the make the upcoming one a minor release, but there will be two breaking changes, so we could discuss whether a minor release is reasonable:
-
There will be a new optional
?config
parameter for all functions which connect to a database or create a connection pool, which can break code which makes higher-order calls or aliases those parts of the signatures. -
The
Caqti_query.t
type will have one additional constructor (V
), which breaks any code which alias the type along with its constructors.
Packaging and TLS
TL;DR: This is mostly a request for comments about packaging.
The Caqti project currently has 11 packages in the official OPAM repository. With the current plan, there will be an additional 4 TLS packages:
packages | description | assessment |
---|---|---|
caqti |
core functionality | required |
caqti-dynload |
dynamic linking | could be merged into caqti |
caqti-driver-mariadb , caqti-driver-pgx , caqti-driver-postgresql , caqti-driver-sqlite |
required | |
caqti-async , caqti-eio , caqti-lwt , caqti-mirage |
required | |
caqti-type-calendar |
convenience | could be retired |
caqti-tls |
core TLS package | see below |
caqti-tls-async , caqti-tls-eio , caqti-tls-lwt |
specialized TLS engines | see below |
(For caqti-mirage
, TLS is included, since the tls
library is the only option to encrypt PostgreSQL communication for unikernels, if not implemented at the network level, AFAIK.)
As indicated above there could be options to eliminate two existing packages, but I’ll leave that for later. The alternatives I’ve considered for the TLS implementation and packaging is:
-
The implemented choice is to use the
tls-async
,tls-eio
,tls-lwt
, andtls-mirage
instantiations of the TLS engine, thus adding one package per flavour. -
TLS support for Async, EIO, and LWT could instead be merged as sublibraries of
caqti-async
,caqti-eio
, andcaqti-lwt
, andcaqti-tls
could be merged intocaqti
. The main reason for not doing this, is the C bindings for MariaDB and PostgreSQL already have TLS built-in, so in most cases thetls
dependency would be redundant. The dependencies could be made optional, though I have the impression many consider optional dependencies harmful. -
The Caqti network abstractions could use the pure TLS engine directly, thus requiring only one extra package,
caqti-tls
. This would be a elegant solution, except that it will not work with thessl
library should we want to support it, since it is tied to the network stack.
While switching to the second option is simple, switching to the third option would require more work on my part, delaying the release, but I could be convinced if we feel strongly for the end result.
The caqti-tls
package is (currently) only needed to define a shared configuration key which depends on the tls
library.