1e31 Supervisor - Telecomix Crypto Munitions Bureau

Supervisor

From Telecomix Crypto Munitions Bureau

Jump to: navigation, search
Supervisors keep track of worker processes. Like as in the picture.

A supervisor only has one single function that it must implement: init().

[edit] init() -> {ok, {RS, MR, MT}, [CS]}

RS = Restart strategy. If a child dies, does the supervisor restart only that child, or what does it do?

MR and MT = Max number of restarts for max time. How much failure will the supervisor tolerate before informing its own supervisor that it has crashed?

CS = list of child specifications.

[edit] Child specifications

is of the form {ChildID, MFA, Restart, Shutdown, Type, Modules}

ChildID can be anything. Preferably the atom name of the child?

MFA is {M, F, A}. Module:Function(Arguments). The start function of the child.

Restart is a child-specific restart strategy. Either the child can be permanent, transient or temporary.

Shutdown is the number of milliseconds that the supervisor will wait for the child to die before brutally killing it. (Alternatively, it could be the atoms infinity and brutal_kill, used to wait forever or not at all.)

Type is either supervisor or worker.

Modules is the modules where the childs callback functions are located. Often just a single module.

[edit] Sources

Personal tools
0