duende_platform/
lib.rs

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