duende_platform/lib.rs
1//! # duende-platform
2//!
3//! Platform adapters for the Duende cross-platform daemon framework.
4//!
5//! This crate provides platform-specific implementations for spawning,
6//! signaling, and monitoring daemons across:
7//!
8//! - **Linux** (systemd): Service units with cgroup resource control
9//! - **macOS** (launchd): Property lists with keep-alive support
10//! - **Container** (Docker/OCI): Container runtime integration
11//! - **pepita** (MicroVM): Virtio-vsock communication
12//! - **WOS** (WebAssembly OS): Process scheduling with priority levels
13//! - **Native** (fallback): Direct process spawning
14//!
15//! ## Iron Lotus Framework
16//!
17//! This crate follows the Iron Lotus Framework principles:
18//! - **Genchi Genbutsu**: Platform detection via direct observation
19//! - **Poka-Yoke**: Feature-gated platform code prevents misuse
20//! - **Standardized Work**: Unified `PlatformAdapter` trait
21//!
22//! ## Example
23//!
24//! ```rust,ignore
25//! use duende_platform::{detect_platform, create_adapter, Platform};
26//!
27//! let platform = detect_platform();
28//! let adapter = create_adapter(platform)?;
29//!
30//! let handle = adapter.spawn(my_daemon).await?;
31//! adapter.signal(&handle, Signal::Term).await?;
32//! ```
33
34#![warn(missing_docs)]
35
36pub mod adapter;
37pub mod detect;
38pub mod error;
39pub mod memory;
40pub mod native;
41
42#[cfg(feature = "linux")]
43pub mod linux;
44
45#[cfg(feature = "macos")]
46pub mod macos;
47
48#[cfg(feature = "container")]
49pub mod container;
50
51#[cfg(feature = "pepita")]
52pub mod pepita;
53
54#[cfg(feature = "wos")]
55pub mod wos;
56
57pub use adapter::{DaemonHandle, PlatformAdapter, TracerHandle};
58pub use detect::{Platform, detect_platform};
59pub use error::{PlatformError, Result};
60pub use memory::{MlockResult, apply_memory_config, is_memory_locked, lock_daemon_memory};
61pub use native::NativeAdapter;