loa_core/
lib.rs

1//! Embeddable Lightweight Observability (elo)
2//!
3//! A library for building observability agents with proper supervision and actor-based architecture.
4//!
5//! # Example
6//!
7//! ```no_run
8//! use elo::Agent;
9//!
10//! #[tokio::main]
11//! async fn main() -> anyhow::Result<()> {
12//!     let agent = Agent::builder()
13//!         .storage_path("/var/lib/loa")
14//!         .build()
15//!         .await?;
16//!
17//!     agent.run().await?;
18//!     Ok(())
19//! }
20//! ```
21
22mod agent;
23mod builder;
24mod identity;
25mod supervisor;
26
27pub mod constants;
28pub mod core;
29pub mod http;
30
31pub use agent::Agent;
32pub use builder::AgentBuilder;
33pub use identity::{AgentIdentity, get_global_identity, init_global_identity};
34
35/// Result type alias for elo operations
36pub type Result<T> = std::result::Result<T, Error>;
37
38/// Error types for elo
39#[derive(Debug, thiserror::Error)]
40pub enum Error {
41    #[error("IO error: {0}")]
42    Io(#[from] std::io::Error),
43
44    #[error("Actor error: {0}")]
45    Actor(String),
46
47    #[error("Configuration error: {0}")]
48    Config(String),
49
50    #[error("Supervisor error: {0}")]
51    Supervisor(String),
52}
53
54// Convert ractor errors to our Error type
55impl From<ractor::SpawnErr> for Error {
56    fn from(e: ractor::SpawnErr) -> Self {
57        Error::Actor(e.to_string())
58    }
59}