Module app_ctrl

May 19, 2022 ยท View on GitHub

API module for app_ctrl.

Copyright (c) 2018-22 Aeternity Anstalt

Authors: Ulf Wiger (ulf@wiger.net).

Description

This module provides the main user interface to app_ctrl.

Data Types

app()


app() = atom()

app_status()


app_status() = running | ok_to_start | load_only

mode()


mode() = atom()

role()


role() = atom()

status()


status() = #{current_mode => mode(), current_roles => [role()], running_locally => [{app(), [node()]}], running_remotely => [{app(), [node()]}], allowed_apps => [app()], role_apps => [{app(), app_status()}]}

Function Index

app_dependencies/1Lists the applications on which App depends.
await_stable_mode/1Waits for the system to become stable (no ongoing mode transition) and returns the active mode, or timeout, including which apps are still pending.
check_for_new_applications/0Checks if applications have been added (or removed) and takes appropriate action.
dependencies_of/1List all applications that depend on App (including start_before dependencies.
get_mode/0Get the current mode.
is_mode_stable/0Checks whether the system is in a stable mode (true), or in transition between modes (false).
set_and_await_mode/2Like set_mode/1, but waits until the transition to the new mode has been completed.
set_mode/1Sets the current mode to Mode.
status/0Returns information about the current state of the system.

Function Details

app_dependencies/1


app_dependencies(App) -> [app()]

Lists the applications on which App depends.

await_stable_mode/1


await_stable_mode(Timeout) -> {ok, mode()} | {timeout, [app()]}
  • Timeout = non_neg_integer() | infinity

Waits for the system to become stable (no ongoing mode transition) and returns the active mode, or timeout, including which apps are still pending.

check_for_new_applications/0


check_for_new_applications() -> ok

Checks if applications have been added (or removed) and takes appropriate action.

dependencies_of/1


dependencies_of(App) -> [app()]

List all applications that depend on App (including start_before dependencies.

get_mode/0


get_mode() -> mode()

Get the current mode.

is_mode_stable/0


is_mode_stable() -> boolean()

Checks whether the system is in a stable mode (true), or in transition between modes (false).

set_and_await_mode/2


set_and_await_mode(Mode, Timeout) -> {ok, Mode} | {timeout, [app()]}
  • Mode = mode()
  • Timeout = non_neg_integer() | infinity

Like set_mode/1, but waits until the transition to the new mode has been completed.

set_mode/1


set_mode(Mode::mode()) -> ok

Sets the current mode to Mode. Will raise an exception if Mode is not a known mode.

status/0


status() -> status()

Returns information about the current state of the system.