Expand description
Engine boot sequence (v0.1.2 — schema/ATTACH layout).
Implements the 8-step boot sequence from plan 14:
- Open engine storage (PG: connect; SQLite: create data_dir + open a router connection that ATTACHes one file per module)
- Apply engine schema migrations (creates
engine.modules,engine.audit,engine.instances,engine.migrations) - Read
engine.modules— on first boot seed it from the running build’s compile-time modules; on subsequent boots just SELECT enabled modules - For each enabled module: PG
CREATE SCHEMA IF NOT EXISTS <m>or SQLite ensure-attached, then run module migrations - Wire trait routing — handled by callers (engine binary builds the
WorkflowStoreagainst the prepared pool) - Engine-level multi-node coordination:
- PG: pg_try_advisory_lock(1) for leader election (existing path)
- SQLite: engine.lock single-row exclusive (existing path)
- Insert into
engine.instanceson startup, refresh on timer, DELETE on graceful shutdown
- Mount HTTP routers from each enabled module (caller wires them)
- Start scheduler, workers, etc. (caller wires them)
EngineBoot returns the prepared pool(s), the engine-events bus,
the instance id, and the list of enabled modules — everything callers
need to compose WorkflowStore, WorkflowCtx, and the HTTP router.
Structs§
- Builtin
Module - One row to seed into
engine.moduleson first boot.default_enabled = falsemeans operators must flip it to TRUE before its migrations run — used for opt-in modules like auth so existing v0.1.2 deployments don’t get unexpected schema changes. - PgBoot
- Sqlite
Boot
Enums§
- Engine
Boot - Result of the engine boot sequence — the parts each backend wired up.
The engine binary uses these to compose its
WorkflowStore/WorkflowCtx/ HTTP router.
Functions§
- builtin_
modules - Built-in modules implied by the running build’s compile-time features.