Arcadic.Transport.Bolt (Arcadic v0.1.0)

Copy Markdown View Source

Bolt transport for ArcadeDB via the boltx driver (Bolt v4). Verified interop (spec §15 P19/P20). The consumer starts a Bolt connection with start_link/1 (which encodes the ArcadeDB-correct defaults — Bolt v4 pin, non-TLS scheme) and passes it as transport_options: [bolt: conn_ref].

Supports the query hot path (execute/4), native fun-based transactions (transaction/3), and a RETURN 1 health check (ready?/1). Server admin (create/drop/list database) is an HTTP/server operation, not a Bolt one — those callbacks return {:error, %Arcadic.Error{reason: :not_supported}}; use an HTTP conn for admin.

Read/write semantics differ from the HTTP transport. Bolt has no /query vs /command endpoint split, so Arcadic.query/4 on a Bolt conn does NOT enforce read-only — the HTTP transport's non-idempotent rejection is the ArcadeDB /query endpoint's server-side behavior, which Bolt lacks. arcadic is statement-agnostic by design (params-only; it never parses statement semantics), so a write issued through query/4 on Bolt executes. Use command/4 for writes on Bolt.

Never enable boltx debug logging against arcadic. config :boltx, log: true (or :log_hex) makes boltx debug-log the full HELLO payload — including the auth credentials (the password). arcadic drives the HELLO itself and never enables this; keep it off so a credential cannot reach a log line (Critical Rule 3).

Summary

Functions

Start a Bolt pool AND return the transport_options for a Conn in one call, so the pool (:bolt, for execute/transaction/ready?) and the per-stream connect opts (:bolt_opts, for query_stream) cannot drift to different hosts/credentials.

Start a boltx connection with ArcadeDB-correct defaults. Opts: :hostname, :port (default 7687), :username, :password, plus any boltx option. Pins Bolt to v4 (ArcadeDB speaks v4; boltx defaults to v5 → version_negotiation_error) and uses the non-TLS bolt scheme (ArcadeDB Bolt is TLS-disabled by default).

Functions

setup(opts)

@spec setup(keyword()) :: {:ok, keyword()} | {:error, term()}

Start a Bolt pool AND return the transport_options for a Conn in one call, so the pool (:bolt, for execute/transaction/ready?) and the per-stream connect opts (:bolt_opts, for query_stream) cannot drift to different hosts/credentials.

{:ok, topts} = Arcadic.Transport.Bolt.setup(hostname: h, port: p, username: "root", password: pw)
conn = Arcadic.connect(url, db, auth: {"root", pw}, transport: Arcadic.Transport.Bolt, transport_options: topts)

start_link(opts)

@spec start_link(keyword()) :: {:ok, pid()} | {:error, term()}

Start a boltx connection with ArcadeDB-correct defaults. Opts: :hostname, :port (default 7687), :username, :password, plus any boltx option. Pins Bolt to v4 (ArcadeDB speaks v4; boltx defaults to v5 → version_negotiation_error) and uses the non-TLS bolt scheme (ArcadeDB Bolt is TLS-disabled by default).