2.4 Entry points and start-up order
A program is a package that contains at least one of: fn main(), a cluster declaration (§12.1), a service declaration. Starting a node:
consts are evaluated (at compile time, §4.1).- The static config is loaded and checked (§14.1). An error terminates the process with exit code 78.
- If there is a
cluster: the node joins the cluster and receives roles (§12.2). Otherwise the node gets the implicit roleall. - The
provides for the node's roles are executed and thedeps are bound (§12.7). - The services, actors, pipelines, topics and leader tasks of the node's roles are brought up.
- If there is a
fn main(), it is executed as the start-up task. An error frommainterminates the process with exit code 1. - If the node hosts nothing (no services, actors, subscriptions, background-scope tasks), it terminates after
mainwith exit code 0. Otherwise it runs until SIGTERM/SIGINT and then drains requests (drainfromcluster.defaults, 30 s by default).
fn main() MAY have the signature fn main() -> () | E; effects are not restricted.
Related diagnostics
See also
Source: docs/spec/oxl-standard.en.md