Arcadic.Conn (Arcadic v0.7.1)

Copy Markdown View Source

Connection handle for ArcadeDB — pure data, no process.

HTTP has no per-connection state; Finch owns the socket pool and the ArcadeDB session (when inside a transaction) rides session_id. Build one with Arcadic.connect/3; derive a same-pool handle on another database with with_database/2.

Summary

Functions

Build a connection handle.

Derive a Bearer-auth handle from a Basic one (typically after Arcadic.Security.login/1).

Derive a handle with a read-consistency level; validates and clears the session. HTTP-only.

Derive a same-pool handle on another database; validates and clears the session.

Types

consistency()

@type consistency() :: :eventual | :read_your_writes | :linearizable

t()

@type t() :: %Arcadic.Conn{
  auth: {String.t(), String.t()} | {:bearer, String.t()},
  base_url: String.t(),
  consistency: consistency(),
  database: String.t(),
  hosts: [String.t()],
  read_after: integer() | nil,
  session_id: String.t() | nil,
  timeout: pos_integer() | nil,
  transport: module(),
  transport_options: keyword()
}

Functions

new(base_url, database, opts \\ [])

@spec new(String.t(), String.t(), keyword()) :: t()

Build a connection handle.

Options

  • :auth{user, pass}. REQUIRED (no default credential).
  • :transport — transport module (default Arcadic.Transport.HTTP).
  • :transport_options — keyword passed to the transport (:finch, :plug, :timeout, pool knobs).
  • :timeout — default per-call receive timeout (ms).
  • :consistency - read-consistency level: :eventual (default) | :read_your_writes | :linearizable. HTTP-only; a non-default level on a Bolt conn raises.

  • :hosts - additional http(s) base URLs for multi-host availability failover (default []). HTTP-only; a non-empty list on a Bolt conn raises.

Examples

iex> Arcadic.connect("http://localhost:2480", "mydb", auth: {"root", "x"}).database
"mydb"

with_bearer(conn, token)

@spec with_bearer(t(), String.t()) :: t()

Derive a Bearer-auth handle from a Basic one (typically after Arcadic.Security.login/1).

with_consistency(conn, level)

@spec with_consistency(t(), consistency()) :: t()

Derive a handle with a read-consistency level; validates and clears the session. HTTP-only.

with_database(conn, database)

@spec with_database(t(), String.t()) :: t()

Derive a same-pool handle on another database; validates and clears the session.