PageRenderTime 21ms CodeModel.GetById 11ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/core/z_supervisor.html

http://github.com/zotonic/zotonic
HTML | 135 lines | 113 code | 22 blank | 0 comment | 0 complexity | 9d45aae29c8490928f8707090f08b01f MD5 | raw file
  1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2<html>
  3<head>
  4<title>Module z_supervisor</title>
  5<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
  6</head>
  7<body bgcolor="white">
  8<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
  9<hr>
 10
 11<h1>Module z_supervisor</h1>
 12<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>Supervisor with a one_for_one strategy and disabling of too-often-crashing resources.
 13<p>Copyright Š 2010 Marc Worrell</p>
 14
 15<p><b>Behaviours:</b> <a href="gen_server.html"><tt>gen_server</tt></a>.</p>
 16<p><b>Authors:</b> Marc Worrell (<a href="mailto:marc@worrell.nl"><tt>marc@worrell.nl</tt></a>).</p>
 17
 18<h2><a name="description">Description</a></h2>Supervisor with a one_for_one strategy and disabling of too-often-crashing resources.
 19  All children of this supervisor should be gen_server/supervisor processes.
 20<h2><a name="index">Function Index</a></h2>
 21<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add_child-2">add_child/2</a></td><td>Add a child, the child will be added and started.</td></tr>
 22<tr><td valign="top"><a href="#check_children-1">check_children/1</a></td><td>Check children, try restarting children when they are in 'error' state.</td></tr>
 23<tr><td valign="top"><a href="#code_change-3">code_change/3</a></td><td>Convert process state when code is changed.</td></tr>
 24<tr><td valign="top"><a href="#delete_child-2">delete_child/2</a></td><td>Delete a child, the child will be terminated and removed.</td></tr>
 25<tr><td valign="top"><a href="#handle_call-3">handle_call/3</a></td><td>Add a child in the stopped state.</td></tr>
 26<tr><td valign="top"><a href="#handle_cast-2">handle_cast/2</a></td><td>Stop a child process and add it to the stopped list.</td></tr>
 27<tr><td valign="top"><a href="#handle_info-2">handle_info/2</a></td><td>Handle the exit of a child.</td></tr>
 28<tr><td valign="top"><a href="#init-1">init/1</a></td><td>Initiates the server.</td></tr>
 29<tr><td valign="top"><a href="#restart_child-2">restart_child/2</a></td><td>Terminate and restart a child.</td></tr>
 30<tr><td valign="top"><a href="#running_children-1">running_children/1</a></td><td>Return the list of running children.</td></tr>
 31<tr><td valign="top"><a href="#set_manager_pid-2">set_manager_pid/2</a></td><td>Set the manager pid for this supervisor.</td></tr>
 32<tr><td valign="top"><a href="#start_child-2">start_child/2</a></td><td>Start a child when it is not running (either failed or stopped).</td></tr>
 33<tr><td valign="top"><a href="#start_link-1">start_link/1</a></td><td></td></tr>
 34<tr><td valign="top"><a href="#start_link-2">start_link/2</a></td><td></td></tr>
 35<tr><td valign="top"><a href="#stop_child-2">stop_child/2</a></td><td>Stop a child, the child will be terminated and put in "stopped" state.</td></tr>
 36<tr><td valign="top"><a href="#terminate-2">terminate/2</a></td><td>This function is called by a gen_server when it is about to
 37  terminate.</td></tr>
 38<tr><td valign="top"><a href="#which_children-1">which_children/1</a></td><td>Return the list of all children and their run state.</td></tr>
 39</table>
 40
 41<h2><a name="functions">Function Details</a></h2>
 42
 43<h3 class="function"><a name="add_child-2">add_child/2</a></h3>
 44<div class="spec">
 45<p><tt>add_child(Pid, ChildSpec) -&gt; any()</tt></p>
 46</div><p>Add a child, the child will be added and started.</p>
 47
 48<h3 class="function"><a name="check_children-1">check_children/1</a></h3>
 49<div class="spec">
 50<p><tt>check_children(Pid) -&gt; any()</tt></p>
 51</div><p>Check children, try restarting children when they are in 'error' state.</p>
 52
 53<h3 class="function"><a name="code_change-3">code_change/3</a></h3>
 54<div class="spec">
 55<p><tt>code_change(OldVsn, State, Extra) -&gt; {ok, NewState}</tt></p>
 56</div><p>Convert process state when code is changed</p>
 57
 58<h3 class="function"><a name="delete_child-2">delete_child/2</a></h3>
 59<div class="spec">
 60<p><tt>delete_child(Pid, Name) -&gt; any()</tt></p>
 61</div><p>Delete a child, the child will be terminated and removed.</p>
 62
 63<h3 class="function"><a name="handle_call-3">handle_call/3</a></h3>
 64<div class="spec">
 65<p><tt>handle_call(Message::Request, From, State) -&gt; {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}</tt></p>
 66</div><p>Add a child in the stopped state.</p>
 67
 68<h3 class="function"><a name="handle_cast-2">handle_cast/2</a></h3>
 69<div class="spec">
 70<p><tt>handle_cast(Message, State) -&gt; any()</tt></p>
 71</div><p>Stop a child process and add it to the stopped list.</p>
 72
 73<h3 class="function"><a name="handle_info-2">handle_info/2</a></h3>
 74<div class="spec">
 75<p><tt>handle_info(Info, State) -&gt; {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}</tt></p>
 76</div><p>Handle the exit of a child</p>
 77
 78<h3 class="function"><a name="init-1">init/1</a></h3>
 79<div class="spec">
 80<p><tt>init(InitialChildren::Args) -&gt; {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}</tt></p>
 81</div><p>Initiates the server.</p>
 82
 83<h3 class="function"><a name="restart_child-2">restart_child/2</a></h3>
 84<div class="spec">
 85<p><tt>restart_child(Pid, Name) -&gt; any()</tt></p>
 86</div><p>Terminate and restart a child.</p>
 87
 88<h3 class="function"><a name="running_children-1">running_children/1</a></h3>
 89<div class="spec">
 90<p><tt>running_children(Pid) -&gt; any()</tt></p>
 91</div><p>Return the list of running children</p>
 92
 93<h3 class="function"><a name="set_manager_pid-2">set_manager_pid/2</a></h3>
 94<div class="spec">
 95<p><tt>set_manager_pid(Pid, ManagerPid) -&gt; any()</tt></p>
 96</div><p>Set the manager pid for this supervisor</p>
 97
 98<h3 class="function"><a name="start_child-2">start_child/2</a></h3>
 99<div class="spec">
100<p><tt>start_child(Pid, Name) -&gt; any()</tt></p>
101</div><p>Start a child when it is not running (either failed or stopped)</p>
102
103<h3 class="function"><a name="start_link-1">start_link/1</a></h3>
104<div class="spec">
105<p><tt>start_link(Args) -&gt; any()</tt></p>
106</div>
107
108<h3 class="function"><a name="start_link-2">start_link/2</a></h3>
109<div class="spec">
110<p><tt>start_link(SupName, Args) -&gt; any()</tt></p>
111</div>
112
113<h3 class="function"><a name="stop_child-2">stop_child/2</a></h3>
114<div class="spec">
115<p><tt>stop_child(Pid, Name) -&gt; any()</tt></p>
116</div><p>Stop a child, the child will be terminated and put in "stopped" state</p>
117
118<h3 class="function"><a name="terminate-2">terminate/2</a></h3>
119<div class="spec">
120<p><tt>terminate(Reason, State) -&gt; <a href="#type-void">void()</a></tt></p>
121</div><p>This function is called by a gen_server when it is about to
122  terminate. It should be the opposite of Module:init/1 and do any necessary
123  cleaning up. When it returns, the gen_server terminates with Reason.
124  The return value is ignored.</p>
125
126<h3 class="function"><a name="which_children-1">which_children/1</a></h3>
127<div class="spec">
128<p><tt>which_children(Pid) -&gt; any()</tt></p>
129</div><p>Return the list of all children and their run state.</p>
130<hr>
131
132<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
133<p><i>Generated by EDoc, Oct 13 2011, 14:45:56.</i></p>
134</body>
135</html>