Crate duende_platform

Crate duende_platform 

Source
Expand description

§duende-platform

Platform adapters for the Duende cross-platform daemon framework.

This crate provides platform-specific implementations for spawning, signaling, and monitoring daemons across:

  • Linux (systemd): Service units with cgroup resource control
  • macOS (launchd): Property lists with keep-alive support
  • Container (Docker/OCI): Container runtime integration
  • pepita (MicroVM): Virtio-vsock communication
  • WOS (WebAssembly OS): Process scheduling with priority levels
  • Native (fallback): Direct process spawning

§Iron Lotus Framework

This crate follows the Iron Lotus Framework principles:

  • Genchi Genbutsu: Platform detection via direct observation
  • Poka-Yoke: Feature-gated platform code prevents misuse
  • Standardized Work: Unified PlatformAdapter trait

§Example

use duende_platform::{detect_platform, create_adapter, Platform};

let platform = detect_platform();
let adapter = create_adapter(platform)?;

let handle = adapter.spawn(my_daemon).await?;
adapter.signal(&handle, Signal::Term).await?;

Re-exports§

pub use adapter::DaemonHandle;
pub use adapter::PlatformAdapter;
pub use adapter::TracerHandle;
pub use detect::Platform;
pub use detect::detect_platform;
pub use error::PlatformError;
pub use error::Result;
pub use memory::MlockResult;
pub use memory::apply_memory_config;
pub use memory::is_memory_locked;
pub use memory::lock_daemon_memory;
pub use native::NativeAdapter;

Modules§

adapter
Platform adapter trait.
detect
Platform detection.
error
Platform error types.
memory
Memory management for daemon processes.
native
Native process adapter (fallback).