ExArrow.ADBC.DatabaseServer (ex_arrow v0.6.0)

View Source

A supervised wrapper around ExArrow.ADBC.Database that holds a database handle open for the lifetime of the process and makes it reachable by name.

This is used in conjunction with ExArrow.ADBC.ConnectionPool so that the pool can look up the database handle by its registered name when creating new worker connections.

Usage

children = [
  {ExArrow.ADBC.DatabaseServer,
    name: :mydb,
    driver_path: "/path/to/libadbc_driver_duckdb.so"},
  {ExArrow.ADBC.ConnectionPool,
    name: :mypool, database: :mydb, pool_size: 4}
]
Supervisor.start_link(children, strategy: :one_for_one)

Options

All options accepted by ExArrow.ADBC.Database.open/1 are forwarded. Additionally:

  • :name — optional registered name for the server (defaults to __MODULE__).

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns the ExArrow.ADBC.Database.t() held by the named server.

Starts a DatabaseServer that opens and holds a database handle.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get(name)

Returns the ExArrow.ADBC.Database.t() held by the named server.

name can be any valid GenServer name: a local atom, a {:global, term} tuple, or a {:via, module, term} tuple.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts a DatabaseServer that opens and holds a database handle.