aimdb_client/lib.rs
1//! AimDB Client Library
2//!
3//! This library provides a client implementation for the AimX remote access
4//! protocol, enabling connections to running AimDB instances via Unix domain
5//! sockets or serial.
6//!
7//! ## Overview
8//!
9//! The client library offers:
10//! - **Connection Management**: [`AimxConnection`] over the shared session engine
11//! - **Protocol Implementation**: the reshaped AimX handshake + RPC/streaming
12//! - **Instance Discovery**: Automatic detection of running AimDB instances
13//! - **Record Operations**: list, get, set, subscribe, drain, graph, query
14//!
15//! ## Usage
16//!
17//! ```no_run
18//! use aimdb_client::AimxConnection;
19//!
20//! #[tokio::main]
21//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
22//! // Connect to an AimDB instance by endpoint (a bare path is the `unix://`
23//! // shorthand; `serial://DEVICE?baud=N` reaches a board). Performs `hello`.
24//! let conn = AimxConnection::connect("unix:///tmp/aimdb.sock").await?;
25//!
26//! // List all records
27//! let records = conn.list_records().await?;
28//! println!("Found {} records", records.len());
29//!
30//! // Get a specific record
31//! let value = conn.get_record("server::Temperature").await?;
32//! println!("Temperature: {:?}", value);
33//!
34//! Ok(())
35//! }
36//! ```
37
38// Instance discovery is a Unix-socket filesystem scan, so it rides the UDS
39// transport feature.
40#[cfg(feature = "transport-uds")]
41pub mod discovery;
42pub mod endpoint;
43pub mod engine;
44pub mod error;
45pub mod protocol;
46
47// Re-export main types for convenience. `AimxConnection` is the engine-based
48// client (the synchronous `AimxClient` was retired with the AimX server port).
49#[cfg(feature = "transport-uds")]
50pub use discovery::{discover_instances, find_instance, InstanceInfo};
51pub use endpoint::{dial, parse_endpoint, ParsedEndpoint, Scheme};
52pub use engine::{AimxConnection, DrainResponse, RecordUpdate};
53pub use error::{ClientError, ClientResult};
54pub use protocol::{RecordMetadata, WelcomeMessage, CLIENT_NAME, PROTOCOL_VERSION};