Skip to content

start

Structs

  • StackHandle - Handle returned by [spawn_stack] and [start] once the stack has

Enums

  • StartMode - Mode in which [start] manages the stack after readiness.

Functions

  • spawn_stack - Spawn the stack and wait for readiness without blocking on supervision.
  • start - Start the authority and sidecar stack.
  • supervise - Run the detached supervisor loop.

Struct

Handle returned by [spawn_stack] and [start] once the stack has reached the ready state.

The handle is informational only: it does not own the children’s lifecycle (pid files on disk are the source of truth). Callers tear the stack down via [crate::stop].

Fields:

  • authority_pid: u32 - PID of the authority component.
  • sidecar_pid: u32 - PID of the sidecar component.
  • state_dir: std::path::PathBuf - Resolved state directory the stack is writing to.

Enum

Mode in which [start] manages the stack after readiness.

Variants:

  • Foreground - Block in the calling thread, forwarding SIGINT / SIGTERM /
  • Detached - Fork a hidden __supervise child that takes over supervision and

Traits: Eq, Copy

Trait Implementations:

  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • PartialEq
    • fn eq(self: &Self, other: &StartMode) -> bool
  • Clone
    • fn clone(self: &Self) -> StartMode

Function

Spawn the stack and wait for readiness without blocking on supervision.

Returns once both components are listening and the sidecar CA material is on disk. The caller owns lifecycle: it must eventually call [crate::stop] to tear the stack down (or rely on the OS reaping pids when the parent process exits).

Used by firma-demo-tui and as the first step of [start].

Returns state-directory, lock, spawn, or readiness errors. On failure after children have been spawned, this function tears them down and removes any pid/listen/lock files it created before returning the error.

fn spawn_stack(cfg: &crate::config::StackConfig, state_dir: &std::path::Path) -> crate::error::Result<StackHandle>

Function

Start the authority and sidecar stack.

Returns state directory, spawn, readiness, or detach errors. On failure after children have been spawned, this function tears them down and removes any pid/listen/lock files it created before returning the error.

fn start(cfg: &crate::config::StackConfig, state_dir: &std::path::Path, mode: StartMode) -> crate::error::Result<StackHandle>

Function

Run the detached supervisor loop.

Returns pidfile or supervision errors.

fn supervise(state_dir: &std::path::Path) -> crate::error::Result<()>