Expand description
Remote access subsystem for AimDB (AimX protocol)
Provides introspection and management APIs over Unix domain sockets, enabling external tools (CLI, dashboards, MCP adapters) to interact with running AimDB instances.
§Protocol
AimX uses NDJSON (newline-delimited JSON) tagged frames over a session
transport (Unix domain sockets via aimdb-uds-connector, serial via
aimdb-serial-connector). The envelope codec lives in session::aimx
(feature connector-session). Compatibility is by major version — see
PROTOCOL_VERSION and version_compatible.
§Security
- Read-only by default: No writes unless explicitly enabled
- UDS permissions: Primary security mechanism (file permissions)
- Optional auth tokens: Additional authentication layer
- Per-record write permissions: Explicit opt-in required
§Usage
Remote access is registered like any other connector — via with_connector
using aimdb_uds_connector::UdsServer (this replaced the former
AimDbBuilder::with_remote_access(config)). Illustrative (not compiled:
the connector lives in a downstream crate aimdb-core cannot depend on):
use aimdb_core::remote::{AimxConfig, SecurityPolicy};
use aimdb_uds_connector::UdsServer;
let config = AimxConfig::uds_default()
.socket_path("/var/run/aimdb/aimdb.sock")
.security_policy(SecurityPolicy::ReadOnly)
.max_connections(16)
.max_subs_per_connection(32);
let (db, runner) = AimDbBuilder::new()
.runtime(tokio_adapter)
.with_connector(UdsServer::from_config(config))
.build()
.await?;Structs§
- Aimx
Config - Configuration for AimX remote access
- Error
Object - Error object in response
- Event
- Event message from server (subscription push)
- Hello
Message - Client hello message
- Query
Handler Params - Parameters for the type-erased query handler.
- Query
Record - One row of a
record.queryresult — the canonical shape every transport shares. - Record
Metadata - Metadata about a registered record type
- Request
- Request message from client
- Welcome
Message - Server welcome message
Enums§
- Remote
Error - Error type for remote access operations
- Response
- Response message from server
- Security
Policy - Security policy for remote access
Constants§
- PROTOCOL_
VERSION - Version of the AimX wire protocol spoken by this crate.
- QUERY_
ALL_ PATTERN - The pattern a
record.querywith nonameresolves to: every record, at every depth. - VERSION_
PARAM - Query-parameter name a WebSocket client uses to declare its
PROTOCOL_VERSIONat the HTTP upgrade. The socket transports gate the version inside thehellohandshake, but a browser cannot set custom headers on the WebSocket handshake and the WS server runsreads_hello:false, so the WS upgrade carries the version in the URL instead (…/ws?v=3.0) and the server refuses an incompatible/absent one before the socket opens. Seews_url_with_version.
Functions§
- topic_
leaf - The leaf (entity) segment of a record key — the trailing component after the
last separator. Both
.and/are treated as delimiters, since keys use either convention (temp.viennaorsensors/temp/vienna), and both yieldvienna. Servers report this as a record’sentity, which identifies the node only where the leaf is the node:station.17.temperatureyieldstemperature, not17. - version_
compatible - Whether a peer advertising
their_versionis wire-compatible with this crate’sPROTOCOL_VERSION. - ws_
url_ with_ version - Append this crate’s
PROTOCOL_VERSIONas theVERSION_PARAMquery parameter to a WebSocket upgradeurl, joining with&ifurlalready carries a query string and?otherwise. Every first-party WS client dialer routes its URL through this so the server’s upgrade-time gate sees a version; keeping theNAME=VALUEcontract here means the reader (the server) and the writers (the dialers) never drift.
Type Aliases§
- Query
Handler Fn - Type-erased query handler registered by
aimdb-persistencevia Extensions. - Remote
Result - Result type for remote operations