Module
pooka/otp/application
src/pooka/otp/application.pookaAn OTP application: a supervision tree with a name, that the node starts and stops as one piece.
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
start(
name: String,
description: String,
top: fn() -> Result(Supervisor, String)
) -> Result(Nil, String)
INFERRED
fn(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.
stop(name: String) -> Nil
INFERRED
fn(String) -> NilStop an application, and every process in its tree.
running() -> List(String)
INFERRED
fn() -> List(String)The names of the applications running on this node, including Erlang's
own, such as kernel.