slave 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +42 -0
- data/VERSION +1 -0
- data/doc/classes/Slave.html +541 -0
- data/doc/classes/Slave/Heartbeat.html +342 -0
- data/doc/created.rid +1 -0
- data/doc/dot/f_0.dot +14 -0
- data/doc/dot/f_0.jpg +0 -0
- data/doc/dot/f_1.dot +14 -0
- data/doc/dot/f_1.jpg +0 -0
- data/doc/dot/f_2.dot +29 -0
- data/doc/dot/f_2.jpg +0 -0
- data/doc/files/README.html +169 -0
- data/doc/files/VERSION.html +107 -0
- data/doc/files/lib/slave_rb.html +119 -0
- data/doc/fr_class_index.html +28 -0
- data/doc/fr_file_index.html +29 -0
- data/doc/fr_method_index.html +39 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +172 -0
- data/gemspec.rb +23 -0
- data/install.rb +201 -0
- data/lib/slave-0.0.0.rb +292 -0
- data/lib/slave.rb +292 -0
- data/rdoc.cmd +1 -0
- data/sample/a.rb +102 -0
- data/slave-0.0.0.gem +0 -0
- metadata +72 -0
@@ -0,0 +1,342 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Slave::Heartbeat</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<h1>Slave::Heartbeat <sup class="type-note">(Class)</sup></h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>In:</strong></td>
|
54
|
+
<td>
|
55
|
+
<a href="../../files/lib/slave_rb.html">
|
56
|
+
lib/slave.rb
|
57
|
+
</a>
|
58
|
+
<br />
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
|
62
|
+
<tr class="top-aligned-row">
|
63
|
+
<td><strong>Parent:</strong></td>
|
64
|
+
<td>
|
65
|
+
Object
|
66
|
+
</td>
|
67
|
+
</tr>
|
68
|
+
</table>
|
69
|
+
</div>
|
70
|
+
<!-- banner header -->
|
71
|
+
|
72
|
+
<div id="bodyContent">
|
73
|
+
|
74
|
+
|
75
|
+
<div id="contextContent">
|
76
|
+
<div id="diagram">
|
77
|
+
<map name="map">
|
78
|
+
<area shape="RECT" coords="28,88,99,40" href="../Slave.html" alt="Slave">
|
79
|
+
</map>
|
80
|
+
<img src="../../dot/f_2.jpg" usemap="#map" border=0 alt="TopLevel">
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
the <a href="Heartbeat.html">Heartbeat</a> class is essentially wrapper
|
86
|
+
over an IPC channel that sends a ping on the channel indicating process
|
87
|
+
health. if either end of the channel is detached the ping will fail and an
|
88
|
+
error will be raised. in this was it is ensured that <a
|
89
|
+
href="../Slave.html">Slave</a> object cannot continue to live without their
|
90
|
+
parent being alive.
|
91
|
+
</p>
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<div id="method-list">
|
97
|
+
<h2 class="section-bar">Methods</h2>
|
98
|
+
|
99
|
+
<div class="name-list">
|
100
|
+
<a href="#M000011">child_start</a>
|
101
|
+
<a href="#M000008">new</a>
|
102
|
+
<a href="#M000010">parent_start</a>
|
103
|
+
<a href="#M000009">start</a>
|
104
|
+
<a href="#M000012">stop</a>
|
105
|
+
<a href="#M000013">trace</a>
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<!-- if includes -->
|
119
|
+
|
120
|
+
|
121
|
+
<!-- if method_list -->
|
122
|
+
<div id="methods">
|
123
|
+
<h2 class="section-bar">Public Class methods</h2>
|
124
|
+
|
125
|
+
<div id="method-M000008" class="method-detail">
|
126
|
+
<a name="M000008"></a>
|
127
|
+
|
128
|
+
<div class="method-heading">
|
129
|
+
<a href="#M000008" class="method-signature">
|
130
|
+
<span class="method-name">new</span><span class="method-args">pulse_rate = 4.2, debug = false</span>
|
131
|
+
</a>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<div class="method-description">
|
135
|
+
<p><a class="source-toggle" href="#"
|
136
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
137
|
+
<div class="method-source-code" id="M000008-source">
|
138
|
+
<pre>
|
139
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 206</span>
|
140
|
+
206: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">pulse_rate</span> = <span class="ruby-value">4.2</span>, <span class="ruby-identifier">debug</span> = <span class="ruby-keyword kw">false</span>
|
141
|
+
207: <span class="ruby-comment cmt">#--{{{</span>
|
142
|
+
208: <span class="ruby-ivar">@pulse_rate</span> = <span class="ruby-constant">Float</span> <span class="ruby-identifier">pulse_rate</span>
|
143
|
+
209: <span class="ruby-ivar">@debug</span> = <span class="ruby-identifier">debug</span>
|
144
|
+
210: <span class="ruby-ivar">@r</span>, <span class="ruby-ivar">@w</span> = <span class="ruby-constant">IO</span><span class="ruby-operator">::</span><span class="ruby-identifier">pipe</span>
|
145
|
+
211: <span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span>
|
146
|
+
212: <span class="ruby-ivar">@ppid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">ppid</span>
|
147
|
+
213: <span class="ruby-ivar">@cid</span> = <span class="ruby-keyword kw">nil</span>
|
148
|
+
214: <span class="ruby-ivar">@thread</span> = <span class="ruby-keyword kw">nil</span>
|
149
|
+
215: <span class="ruby-ivar">@ppid</span> = <span class="ruby-keyword kw">nil</span>
|
150
|
+
216: <span class="ruby-ivar">@whoami</span> = <span class="ruby-keyword kw">nil</span>
|
151
|
+
217: <span class="ruby-ivar">@beating</span> = <span class="ruby-keyword kw">nil</span>
|
152
|
+
218: <span class="ruby-ivar">@pipe</span> = <span class="ruby-keyword kw">nil</span>
|
153
|
+
219: <span class="ruby-comment cmt">#--}}}</span>
|
154
|
+
220: <span class="ruby-keyword kw">end</span>
|
155
|
+
</pre>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
<h2 class="section-bar">Public Instance methods</h2>
|
161
|
+
|
162
|
+
<div id="method-M000011" class="method-detail">
|
163
|
+
<a name="M000011"></a>
|
164
|
+
|
165
|
+
<div class="method-heading">
|
166
|
+
<a href="#M000011" class="method-signature">
|
167
|
+
<span class="method-name">child_start</span><span class="method-args">()</span>
|
168
|
+
</a>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div class="method-description">
|
172
|
+
<p><a class="source-toggle" href="#"
|
173
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
174
|
+
<div class="method-source-code" id="M000011-source">
|
175
|
+
<pre>
|
176
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 254</span>
|
177
|
+
254: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">child_start</span>
|
178
|
+
255: <span class="ruby-comment cmt">#--{{{</span>
|
179
|
+
256: <span class="ruby-ivar">@whoami</span> = <span class="ruby-value str">'child'</span>
|
180
|
+
257: <span class="ruby-ivar">@pid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span>
|
181
|
+
258: <span class="ruby-ivar">@ppid</span> = <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">ppid</span>
|
182
|
+
259: <span class="ruby-ivar">@thread</span> =
|
183
|
+
260: <span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">current</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cur</span><span class="ruby-operator">|</span>
|
184
|
+
261: <span class="ruby-keyword kw">begin</span>
|
185
|
+
262: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
186
|
+
263: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">"<#{ @whoami }> <#{ @pid }> puts <#{ @pid }>"</span> }
|
187
|
+
264: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@pid</span>
|
188
|
+
265: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">kill</span> <span class="ruby-value">0</span>, <span class="ruby-ivar">@ppid</span>
|
189
|
+
266: <span class="ruby-identifier">sleep</span> <span class="ruby-ivar">@pulse_rate</span>
|
190
|
+
267: <span class="ruby-keyword kw">end</span>
|
191
|
+
268: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
192
|
+
269: <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
193
|
+
270: <span class="ruby-keyword kw">ensure</span>
|
194
|
+
271: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
195
|
+
272: <span class="ruby-keyword kw">end</span>
|
196
|
+
273: <span class="ruby-keyword kw">end</span>
|
197
|
+
274: <span class="ruby-comment cmt">#--}}}</span>
|
198
|
+
275: <span class="ruby-keyword kw">end</span>
|
199
|
+
</pre>
|
200
|
+
</div>
|
201
|
+
</div>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
<div id="method-M000010" class="method-detail">
|
205
|
+
<a name="M000010"></a>
|
206
|
+
|
207
|
+
<div class="method-heading">
|
208
|
+
<a href="#M000010" class="method-signature">
|
209
|
+
<span class="method-name">parent_start</span><span class="method-args">()</span>
|
210
|
+
</a>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<div class="method-description">
|
214
|
+
<p><a class="source-toggle" href="#"
|
215
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
216
|
+
<div class="method-source-code" id="M000010-source">
|
217
|
+
<pre>
|
218
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 235</span>
|
219
|
+
235: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parent_start</span>
|
220
|
+
236: <span class="ruby-comment cmt">#--{{{</span>
|
221
|
+
237: <span class="ruby-ivar">@whoami</span> = <span class="ruby-value str">'parent'</span>
|
222
|
+
238: <span class="ruby-ivar">@thread</span> =
|
223
|
+
239: <span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-constant">Thread</span><span class="ruby-operator">::</span><span class="ruby-identifier">current</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cur</span><span class="ruby-operator">|</span>
|
224
|
+
240: <span class="ruby-keyword kw">begin</span>
|
225
|
+
241: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
226
|
+
242: <span class="ruby-identifier">buf</span> = <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">gets</span>
|
227
|
+
243: <span class="ruby-identifier">trace</span>{ <span class="ruby-node">"<#{ @whoami }> <#{ @pid }> gets <#{ buf.inspect }>"</span> }
|
228
|
+
244: <span class="ruby-ivar">@cid</span> = <span class="ruby-constant">Integer</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cid</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">buf</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%/^\s*\d+\s*$/</span>
|
229
|
+
245: <span class="ruby-keyword kw">end</span>
|
230
|
+
246: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
231
|
+
247: <span class="ruby-identifier">cur</span>.<span class="ruby-identifier">raise</span> <span class="ruby-identifier">e</span>
|
232
|
+
248: <span class="ruby-keyword kw">ensure</span>
|
233
|
+
249: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
234
|
+
250: <span class="ruby-keyword kw">end</span>
|
235
|
+
251: <span class="ruby-keyword kw">end</span>
|
236
|
+
252: <span class="ruby-comment cmt">#--}}}</span>
|
237
|
+
253: <span class="ruby-keyword kw">end</span>
|
238
|
+
</pre>
|
239
|
+
</div>
|
240
|
+
</div>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
<div id="method-M000009" class="method-detail">
|
244
|
+
<a name="M000009"></a>
|
245
|
+
|
246
|
+
<div class="method-heading">
|
247
|
+
<a href="#M000009" class="method-signature">
|
248
|
+
<span class="method-name">start</span><span class="method-args">()</span>
|
249
|
+
</a>
|
250
|
+
</div>
|
251
|
+
|
252
|
+
<div class="method-description">
|
253
|
+
<p><a class="source-toggle" href="#"
|
254
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
255
|
+
<div class="method-source-code" id="M000009-source">
|
256
|
+
<pre>
|
257
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 221</span>
|
258
|
+
221: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
|
259
|
+
222: <span class="ruby-comment cmt">#--{{{</span>
|
260
|
+
223: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-identifier">pid</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@pid</span>
|
261
|
+
224: <span class="ruby-ivar">@w</span>.<span class="ruby-identifier">close</span>
|
262
|
+
225: <span class="ruby-ivar">@pipe</span> = <span class="ruby-ivar">@r</span>
|
263
|
+
226: <span class="ruby-identifier">parent_start</span>
|
264
|
+
227: <span class="ruby-keyword kw">else</span>
|
265
|
+
228: <span class="ruby-ivar">@r</span>.<span class="ruby-identifier">close</span>
|
266
|
+
229: <span class="ruby-ivar">@pipe</span> = <span class="ruby-ivar">@w</span>
|
267
|
+
230: <span class="ruby-identifier">child_start</span>
|
268
|
+
231: <span class="ruby-keyword kw">end</span>
|
269
|
+
232: <span class="ruby-ivar">@beating</span> = <span class="ruby-keyword kw">true</span>
|
270
|
+
233: <span class="ruby-comment cmt">#--}}}</span>
|
271
|
+
234: <span class="ruby-keyword kw">end</span>
|
272
|
+
</pre>
|
273
|
+
</div>
|
274
|
+
</div>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div id="method-M000012" class="method-detail">
|
278
|
+
<a name="M000012"></a>
|
279
|
+
|
280
|
+
<div class="method-heading">
|
281
|
+
<a href="#M000012" class="method-signature">
|
282
|
+
<span class="method-name">stop</span><span class="method-args">()</span>
|
283
|
+
</a>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
<div class="method-description">
|
287
|
+
<p><a class="source-toggle" href="#"
|
288
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
289
|
+
<div class="method-source-code" id="M000012-source">
|
290
|
+
<pre>
|
291
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 276</span>
|
292
|
+
276: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stop</span>
|
293
|
+
277: <span class="ruby-comment cmt">#--{{{</span>
|
294
|
+
278: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"not beating"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@beating</span>
|
295
|
+
279: <span class="ruby-ivar">@thread</span>.<span class="ruby-identifier">kill</span>
|
296
|
+
280: <span class="ruby-ivar">@pipe</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
297
|
+
281: <span class="ruby-ivar">@beating</span> = <span class="ruby-keyword kw">false</span>
|
298
|
+
282: <span class="ruby-comment cmt">#--}}}</span>
|
299
|
+
283: <span class="ruby-keyword kw">end</span>
|
300
|
+
</pre>
|
301
|
+
</div>
|
302
|
+
</div>
|
303
|
+
</div>
|
304
|
+
|
305
|
+
<div id="method-M000013" class="method-detail">
|
306
|
+
<a name="M000013"></a>
|
307
|
+
|
308
|
+
<div class="method-heading">
|
309
|
+
<a href="#M000013" class="method-signature">
|
310
|
+
<span class="method-name">trace</span><span class="method-args">() {|| ...}</span>
|
311
|
+
</a>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
<div class="method-description">
|
315
|
+
<p><a class="source-toggle" href="#"
|
316
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
317
|
+
<div class="method-source-code" id="M000013-source">
|
318
|
+
<pre>
|
319
|
+
<span class="ruby-comment cmt"># File lib/slave.rb, line 284</span>
|
320
|
+
284: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">trace</span>
|
321
|
+
285: <span class="ruby-comment cmt">#--{{{</span>
|
322
|
+
286: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-keyword kw">yield</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@debug</span> <span class="ruby-keyword kw">and</span> <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">tty?</span>
|
323
|
+
287: <span class="ruby-comment cmt">#--}}}</span>
|
324
|
+
288: <span class="ruby-keyword kw">end</span>
|
325
|
+
</pre>
|
326
|
+
</div>
|
327
|
+
</div>
|
328
|
+
</div>
|
329
|
+
|
330
|
+
|
331
|
+
</div>
|
332
|
+
|
333
|
+
|
334
|
+
</div>
|
335
|
+
|
336
|
+
|
337
|
+
<div id="validator-badges">
|
338
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
</body>
|
342
|
+
</html>
|
data/doc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Fri Nov 12 12:27:08 MST 2004
|
data/doc/dot/f_0.dot
ADDED
data/doc/dot/f_0.jpg
ADDED
Binary file
|
data/doc/dot/f_1.dot
ADDED
data/doc/dot/f_1.jpg
ADDED
Binary file
|
data/doc/dot/f_2.dot
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
digraph TopLevel {
|
2
|
+
compound = true
|
3
|
+
bgcolor = lightcyan1
|
4
|
+
fontname = Arial
|
5
|
+
fontsize = 8
|
6
|
+
label = "lib/slave.rb"
|
7
|
+
node [
|
8
|
+
fontname = Arial,
|
9
|
+
fontsize = 8,
|
10
|
+
color = black
|
11
|
+
]
|
12
|
+
|
13
|
+
subgraph cluster_1 {
|
14
|
+
fontname = Arial
|
15
|
+
color = red
|
16
|
+
label = "lib/slave.rb"
|
17
|
+
Slave [
|
18
|
+
fontcolor = black,
|
19
|
+
URL = "classes/Slave.html",
|
20
|
+
shape = ellipse,
|
21
|
+
color = palegoldenrod,
|
22
|
+
style = filled,
|
23
|
+
label = "Slave"
|
24
|
+
]
|
25
|
+
|
26
|
+
}
|
27
|
+
|
28
|
+
}
|
29
|
+
|
data/doc/dot/f_2.jpg
ADDED
Binary file
|
@@ -0,0 +1,169 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: README</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>README</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>README
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Fri Nov 12 12:27:06 MST 2004</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
<div id="contextContent">
|
69
|
+
<div id="diagram">
|
70
|
+
<map name="map">
|
71
|
+
</map>
|
72
|
+
<img src="../dot/f_0.jpg" usemap="#map" border=0 alt="TopLevel">
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
the <a href="../classes/Slave.html">Slave</a> class forks a process and
|
78
|
+
starts a drb server in the child using any object as the server. the
|
79
|
+
process is detached so it is not required (nor possible) to wait on the
|
80
|
+
child pid. a Heartbeat is set up between the parent and child processes so
|
81
|
+
that the child will exit of the parent exits for any reason - preventing
|
82
|
+
orphaned slaves from running indefinitely. the purpose of Slaves is to be
|
83
|
+
able to easily set up a collection of objects communicating via drb
|
84
|
+
protocols instead of having to use IPC.
|
85
|
+
</p>
|
86
|
+
<p>
|
87
|
+
typical usage:
|
88
|
+
</p>
|
89
|
+
<pre>
|
90
|
+
obj = AnyClass::new
|
91
|
+
|
92
|
+
slave = Slave::new obj
|
93
|
+
|
94
|
+
p slave.object # handle on drb object
|
95
|
+
p slave.uri # uri of the drb object
|
96
|
+
p slave.socket # unix domain socket path for drb object
|
97
|
+
p slave.psname # title shown in ps/top
|
98
|
+
</pre>
|
99
|
+
<p>
|
100
|
+
other usage:
|
101
|
+
</p>
|
102
|
+
<p>
|
103
|
+
set the pulse_rate used for the Heartbeat
|
104
|
+
</p>
|
105
|
+
<pre>
|
106
|
+
slave = Slave::new MyClass::new, 'pulse_rate' => 10
|
107
|
+
</pre>
|
108
|
+
<p>
|
109
|
+
same
|
110
|
+
</p>
|
111
|
+
<pre>
|
112
|
+
Slave::pulse_rate = 10
|
113
|
+
slave = Slave::new MyClass::new
|
114
|
+
</pre>
|
115
|
+
<p>
|
116
|
+
same
|
117
|
+
</p>
|
118
|
+
<pre>
|
119
|
+
ENV['SLAVE_PULSE_RATE'] = 10
|
120
|
+
slave = Slave::new MyClass::new
|
121
|
+
</pre>
|
122
|
+
<p>
|
123
|
+
slaves may be configured via the environment, the <a
|
124
|
+
href="../classes/Slave.html">Slave</a> class, or via the ctor for object
|
125
|
+
itself. attributes which may be configured include
|
126
|
+
</p>
|
127
|
+
<ul>
|
128
|
+
<li>socket_creation_attempts
|
129
|
+
|
130
|
+
</li>
|
131
|
+
<li>pulse_rate
|
132
|
+
|
133
|
+
</li>
|
134
|
+
<li>psname
|
135
|
+
|
136
|
+
</li>
|
137
|
+
<li>debug
|
138
|
+
|
139
|
+
</li>
|
140
|
+
</ul>
|
141
|
+
|
142
|
+
</div>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<!-- if includes -->
|
156
|
+
|
157
|
+
|
158
|
+
<!-- if method_list -->
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
<div id="validator-badges">
|
165
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
</body>
|
169
|
+
</html>
|