Module

pooka/otp/application

src/pooka/otp/application.pooka

An OTP application: a supervision tree with a name, that the node starts and stops as one piece.

Pooka
import pooka/otp
import pooka/otp/application
import pooka/otp/supervisor.{Strategy}

main() {
  let assert Ok(_) = application.start("bakery", "Bread, on time", fn() {
    supervisor.start(supervisor.spec(Strategy.OneForOne, []))
  })
  otp.sleep_forever()
}

The application is described while the program runs, so there is no .app file to write. It is a real OTP application all the same: application:which_applications() lists it, and stopping it stops the whole tree in order.

API reference

function

start

src/pooka/otp/application.pooka:42
start(
  name: String,
  description: String,
  top: fn() -> Result(Supervisor, String)
) -> Result(Nil, String)
INFERREDfn(String, String, fn() -> Result(pooka/otp/supervisor.Supervisor, String)) -> Result(Nil, String)

Start an application whose top supervisor is started by top. Returns once the whole tree is running.

function

stop

src/pooka/otp/application.pooka:54
stop(name: String) -> Nil
INFERREDfn(String) -> Nil

Stop an application, and every process in its tree.

function

running

src/pooka/otp/application.pooka:60
running() -> List(String)
INFERREDfn() -> List(String)

The names of the applications running on this node, including Erlang's own, such as kernel.