Skip to content

dql server

Synopsis

dql server [options]

Description

Start a relay protocol server on a Unix domain socket. The relay protocol is a custom binary protocol using MessagePack serialization with length-prefixed framing, modeled after Plan 9’s 9P.

The server is intended for editor integration and programmatic access. Multiple concurrent result handles are supported per connection via handle-based multiplexing.

See crates/delightql-protocol/protocol/SQL9-PROTOCOL-2.md for the full protocol specification.

Options

--socket path
Unix socket path. Default: /tmp/dql-<pid>.sock.

--workers n
Number of worker threads. Default: available CPUs.

--idle-timeout seconds
Shut down after n seconds with no messages. 0 disables. Default: 0.

--socket-idle-timeout seconds
Shut down after n seconds with zero active connections. 0 disables. Default: 0.

--db database
Database file or connection URI. If provided, each worker pre-mounts it as the main namespace.

Protocol overview

The protocol is client-driven: the server never speaks unprompted. Every exchange is a request-response pair.

Data terms (Layer 0):

Client sends Server responds with
Version Version or Error
Query Header, Data, End
Fetch Data or End
Stat Metadata
Close Ok
Prepare Ok
Offer Ok (with count hint)

Control operations (Layer 1):

Operation Description
Reset Clear session state
Cwd Set base path for relative file resolution
Shutdown Terminate server

Examples

# Default socket
dql server --db my_database.db

# Custom socket with idle timeout
dql server --socket /tmp/my-dql.sock --db my_database.db --idle-timeout 300

See Also

dql(1)