OxL Reference

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:

  1. consts are evaluated (at compile time, §4.1).
  2. The static config is loaded and checked (§14.1). An error terminates the process with exit code 78.
  3. If there is a cluster: the node joins the cluster and receives roles (§12.2). Otherwise the node gets the implicit role all.
  4. The provides for the node's roles are executed and the deps are bound (§12.7).
  5. The services, actors, pipelines, topics and leader tasks of the node's roles are brought up.
  6. If there is a fn main(), it is executed as the start-up task. An error from main terminates the process with exit code 1.
  7. If the node hosts nothing (no services, actors, subscriptions, background-scope tasks), it terminates after main with exit code 0. Otherwise it runs until SIGTERM/SIGINT and then drains requests (drain from cluster.defaults, 30 s by default).

fn main() MAY have the signature fn main() -> () | E; effects are not restricted.

no-entry-point

See also

Source: docs/spec/oxl-standard.en.md