ides_family (ides v0.2.0)

View Source

Type definitions and tree-walking primitives for ides.

Summary

Types

A worker (leaf) process. Includes its restart_type as defined in the parent supervisor's child spec.

Restart type of a child process.

Tagged source of a kill: which process and by what mechanism.

Link relationship info for a process.

Monitor relationship info for a process.

A process in the supervision tree: a supervisor or a worker.

A supervisor process. Contains its strategy and ordered list of children. When this supervisor is also a child of another supervisor, restart_type is present.

Restart strategy of a supervisor.

Functions

Walk the supervision tree from the topmost ancestor down to TargetPid. Returns the tree including the ancestor chain and all siblings at each level.

Types

child_process()

-type child_process() ::
          #{name := string(), pid := pid(), type := worker, restart_type := child_restart_type()}.

A worker (leaf) process. Includes its restart_type as defined in the parent supervisor's child spec.

child_restart_type()

-type child_restart_type() :: permanent | transient | temporary.

Restart type of a child process.

kill_source()

-type kill_source() :: {ancestor, pid()} | {sibling, pid()} | {link, pid()} | {monitor, pid()}.

Tagged source of a kill: which process and by what mechanism.

monitor_info()

-type monitor_info() :: #{monitors := [pid()], monitored_by := [pid()]}.

Monitor relationship info for a process.

parent_info()

-type parent_info() ::
          #{sup_pid := pid(),
            sup_strategy := supervisor_strategy(),
            child_pids := [{term(), pid()}],
            target_position => pos_integer()}.

process()

-type process() :: supervisor_process() | child_process().

A process in the supervision tree: a supervisor or a worker.

supervisor_process()

-type supervisor_process() ::
          #{name := string(),
            pid := pid(),
            type := supervisor,
            strategy := supervisor_strategy(),
            restart_type => child_restart_type(),
            children := [process()]}.

A supervisor process. Contains its strategy and ordered list of children. When this supervisor is also a child of another supervisor, restart_type is present.

supervisor_strategy()

-type supervisor_strategy() :: one_for_one | one_for_all | rest_for_one | simple_one_for_one.

Restart strategy of a supervisor.

Functions

ancestors(TargetPid)

-spec ancestors(TargetPid :: pid()) -> {ok, process()} | {error, term()}.

Walk the supervision tree from the topmost ancestor down to TargetPid. Returns the tree including the ancestor chain and all siblings at each level.

get_ancestors(Pid)

-spec get_ancestors(Pid :: pid()) -> {ok, [term()]} | {error, term()}.

get_restart_type(SupPid, Id)

-spec get_restart_type(SupPid :: pid(), Id :: term()) -> child_restart_type().

parent_info(Pid)

-spec parent_info(Pid :: pid()) -> {ok, parent_info()} | {error, term()}.

resolve_pid(Pid)

-spec resolve_pid(Pid :: term()) -> pid().