Skip to main content

lightshuttle_runtime/
lib.rs

1//! Container runtime backends and lifecycle manager for LightShuttle.
2//!
3//! This crate provides:
4//!
5//! - A narrow [`ContainerRuntime`] trait that the lifecycle manager
6//!   targets and that hides the daemon-specific surface.
7//! - A first concrete implementation [`DockerRuntime`] backed by the
8//!   `bollard` crate.
9//! - A [`ContainerSpec`] value built from a `lightshuttle-manifest`
10//!   resource declaration, with the v0 defaults already applied
11//!   (image expansion, database name derivation, random password
12//!   generation, healthcheck materialisation).
13//! - A [`LifecycleManager`] that consumes a [`LifecyclePlan`] and a
14//!   runtime, then orchestrates startup (topological, parallel where
15//!   possible, gated on healthchecks), supervises the running stack
16//!   and rolls everything down on signal.
17//!
18//! See `docs/spec/manifest-v0.md` in the main repository for the
19//! manifest specification this runtime consumes.
20
21pub use crate::docker::{DockerRuntime, LABEL_PROJECT, LABEL_RESOURCE, ManagedContainer};
22pub use crate::error::{Result, RuntimeError};
23pub use crate::lifecycle::{
24    LifecycleError, LifecycleEvent, LifecycleHandle, LifecycleHandleError, LifecycleManager,
25    LifecyclePlan, ManagerHandle, NodeStatus, PlanNode, ResourceStatus, ResourceView,
26};
27pub use crate::runtime::{
28    ContainerId, ContainerRuntime, ContainerStatus, LogChunk, LogChunkStream, LogStream,
29};
30pub use crate::spec::{
31    ContainerSpec, HealthcheckSpec, ImageSource, PortBinding, ResolvedResource, ResourceOutputs,
32    VolumeBinding, VolumeSource, from_resource,
33};
34
35mod docker;
36mod error;
37mod lifecycle;
38mod runtime;
39mod spec;
40
41pub mod testkit;