aimdb_client/lib.rs
1//! AimDB Client Library
2//!
3//! This library provides a client implementation for the AimX v1 remote access protocol,
4//! enabling connections to running AimDB instances via Unix domain sockets.
5//!
6//! ## Overview
7//!
8//! The client library offers:
9//! - **Connection Management**: Async client for Unix domain socket communication
10//! - **Protocol Implementation**: AimX v1 handshake and message handling
11//! - **Instance Discovery**: Automatic detection of running AimDB instances
12//! - **Record Operations**: List, get, set, subscribe to records
13//!
14//! ## Usage
15//!
16//! ```no_run
17//! use aimdb_client::AimxClient;
18//!
19//! #[tokio::main]
20//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
21//! // Connect to an AimDB instance
22//! let mut client = AimxClient::connect("/tmp/aimdb.sock").await?;
23//!
24//! // List all records
25//! let records = client.list_records().await?;
26//! println!("Found {} records", records.len());
27//!
28//! // Get a specific record
29//! let value = client.get_record("server::Temperature").await?;
30//! println!("Temperature: {:?}", value);
31//!
32//! Ok(())
33//! }
34//! ```
35
36pub mod connection;
37pub mod discovery;
38pub mod error;
39pub mod protocol;
40
41// Re-export main types for convenience
42pub use connection::{AimxClient, DrainResponse};
43pub use discovery::{discover_instances, find_instance, InstanceInfo};
44pub use error::{ClientError, ClientResult};
45pub use protocol::{
46 cli_hello, parse_message, serialize_message, Event, EventMessage, RecordMetadata, Request,
47 RequestExt, Response, ResponseExt, WelcomeMessage, CLIENT_NAME, PROTOCOL_VERSION,
48};