TypeDB.HTTP.Httpc (TypeDB v0.2.0)

Copy Markdown View Source

TypeDB.HTTP adapter built on OTP's :httpc, for deployments that must run on OTP alone.

TypeDB.HTTP.Finch is the default and is several times faster under concurrency — see TypeDB.HTTP for the measurements. Choose this one when reaching outside OTP is not an option, and know what it costs.

Each connection gets its own :httpc profile, so connection pooling, keep-alive and socket limits are isolated from the rest of the application (and from other TypeDB connections).

Options

  • :profile — profile name. Defaults to one derived from the connection name.
  • :max_sessions — max simultaneous sockets per host. Defaults to 50.
  • :max_keep_alive_length — max requests queued per keep-alive socket. Defaults to 100.
  • :keep_alive_timeout — idle keep-alive socket lifetime, ms. Defaults to 120_000.
  • :ssl — TLS options passed to :ssl. Merged over the secure defaults below, so you only need to override what differs.
  • :cacertfile — convenience shortcut for a custom CA bundle path.

TLS

Certificate verification is on by default and cannot be disabled by accident: the defaults are verify: :verify_peer, the OS trust store via :public_key.cacerts_get/0, hostname checking via :public_key.pkix_verify_hostname_match_fun(:https), and TLS 1.2/1.3.

To pin a private CA, in the connection's options:

http: {TypeDB.HTTP.Httpc, cacertfile: "/etc/ssl/private-ca.pem"}

Summary

Types

t()

@type t() :: %TypeDB.HTTP.Httpc{profile: atom(), ssl_opts: keyword()}