mothership 0.0.100

Process supervisor with HTTP exposure - wrap, monitor, and expose your fleet
Documentation
//! Flagship coordination for multi-server fleet deployments
//!
//! When deploying multiple Motherships across different servers:
//! - **Uplinks** are verified on ALL instances (each checks its own connectivity)
//! - **Prelaunch/migrations** run on ONLY ONE instance (the Flagship)
//! - If the Flagship can't run migrations, the **entire deployment aborts**
//!
//! ## Election Backends
//!
//! - `static`: Explicit designation via env var or command output
//! - `postgres`: Automatic election via `pg_advisory_lock()` with LISTEN/NOTIFY signaling
//!
//! ## Example Configuration
//!
//! ```toml
//! [[mothership.uplinks]]
//! name = "primary-db"
//! url = "postgres://localhost:5432/myapp"
//!
//! [mothership.flagship]
//! enabled = true
//! election = "postgres"
//! election_uplink = "primary-db"
//! ```
//!
//! ## State Machine
//!
//! ```mermaid
//! stateDiagram-v2
//!     [*] --> Starting
//!     Starting --> VerifyUplinks
//!     VerifyUplinks --> Electing
//!     Electing --> RunningPrelaunch: Flagship
//!     Electing --> WaitingForSignal: Escort
//!     RunningPrelaunch --> SignalReady: Success
//!     RunningPrelaunch --> SignalAbort: Failure
//!     SignalReady --> LaunchFleet
//!     WaitingForSignal --> LaunchFleet: Ready
//!     WaitingForSignal --> Failed: Abort/Timeout
//!     SignalAbort --> Failed
//!     LaunchFleet --> Running
//!     Running --> [*]
//!     Failed --> [*]
//! ```

mod coordinator;
mod election;

pub use coordinator::{Coordinator, FlagshipRole, FlagshipState};
pub use election::{Election, ElectionError, FlagshipSignal, StaticElection};

#[cfg(feature = "tokio-postgres")]
mod postgres;
#[cfg(feature = "tokio-postgres")]
pub use postgres::PostgresElection;