marilyn-rpc 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENCE +18 -0
- data/README.md +170 -0
- data/doc/MarilynRPC/CallRequestMail.html +578 -0
- data/doc/MarilynRPC/CallResponseMail.html +418 -0
- data/doc/MarilynRPC/Envelope.html +705 -0
- data/doc/MarilynRPC/ExceptionMail.html +338 -0
- data/doc/MarilynRPC/Gentleman.html +658 -0
- data/doc/MarilynRPC/MailFactory.html +284 -0
- data/doc/MarilynRPC/MailHelper.html +489 -0
- data/doc/MarilynRPC/NativeClient.html +579 -0
- data/doc/MarilynRPC/NativeClientProxy.html +303 -0
- data/doc/MarilynRPC/Server.html +406 -0
- data/doc/MarilynRPC/Service.html +599 -0
- data/doc/MarilynRPC/ServiceCache.html +481 -0
- data/doc/MarilynRPC.html +108 -0
- data/doc/_index.html +219 -0
- data/doc/class_list.html +36 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +318 -0
- data/doc/file.README.html +154 -0
- data/doc/file_list.html +38 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +154 -0
- data/doc/js/app.js +203 -0
- data/doc/js/full_list.js +149 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +467 -0
- data/doc/top-level-namespace.html +88 -0
- data/examples/async/client.rb +40 -0
- data/examples/async/server.rb +26 -0
- data/examples/callbacks/client.rb +8 -0
- data/examples/callbacks/server.rb +26 -0
- data/examples/secure/client.rb +9 -0
- data/examples/secure/server.rb +22 -0
- data/kiss.png +0 -0
- data/lib/marilyn-rpc/client.rb +91 -26
- data/lib/marilyn-rpc/gentleman.rb +4 -1
- data/lib/marilyn-rpc/mails.rb +1 -1
- data/lib/marilyn-rpc/server.rb +27 -3
- data/lib/marilyn-rpc/service.rb +64 -0
- data/lib/marilyn-rpc/service_cache.rb +13 -2
- data/lib/marilyn-rpc/version.rb +1 -1
- metadata +39 -3
@@ -0,0 +1,406 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>Module: MarilynRPC::Server</title>
|
7
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
relpath = '..';
|
12
|
+
if (relpath != '') relpath += '/';
|
13
|
+
</script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<script type="text/javascript" charset="utf-8">
|
20
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
21
|
+
</script>
|
22
|
+
|
23
|
+
<div id="header">
|
24
|
+
<div id="menu">
|
25
|
+
|
26
|
+
<a href="../_index.html">Index (S)</a> »
|
27
|
+
<span class='title'><span class='object_link'><a href="../MarilynRPC.html" title="MarilynRPC (module)">MarilynRPC</a></span></span>
|
28
|
+
»
|
29
|
+
<span class="title">Server</span>
|
30
|
+
|
31
|
+
|
32
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="search">
|
36
|
+
<a id="class_list_link" href="#">Class List</a>
|
37
|
+
<a id="method_list_link" href="#">Method List</a>
|
38
|
+
<a id ="file_list_link" href="#">File List</a>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div class="clear"></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<iframe id="search_frame"></iframe>
|
45
|
+
|
46
|
+
<div id="content"><h1>Module: MarilynRPC::Server
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
</h1>
|
51
|
+
|
52
|
+
<dl class="box">
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<dt class="r1 last">Defined in:</dt>
|
62
|
+
<dd class="r1 last">lib/marilyn-rpc/server.rb</dd>
|
63
|
+
|
64
|
+
</dl>
|
65
|
+
<div class="clear"></div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<h2>
|
72
|
+
Instance Method Summary
|
73
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
74
|
+
</h2>
|
75
|
+
|
76
|
+
<ul class="summary">
|
77
|
+
|
78
|
+
<li class="public ">
|
79
|
+
<span class="summary_signature">
|
80
|
+
|
81
|
+
<a href="#post_init-instance_method" title="#post_init (instance method)">- (Object) <strong>post_init</strong> </a>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
</span>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
<span class="summary_desc"><div class='inline'><p>Initialize the first recieving envelope for the connection and create the service cache since each connection gets it’s own service instance.</p></div></span>
|
95
|
+
|
96
|
+
</li>
|
97
|
+
|
98
|
+
|
99
|
+
<li class="public ">
|
100
|
+
<span class="summary_signature">
|
101
|
+
|
102
|
+
<a href="#receive_data-instance_method" title="#receive_data (instance method)">- (Object) <strong>receive_data</strong>(data) </a>
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
</span>
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<span class="summary_desc"><div class='inline'><p>Handler for the incoming data.</p></div></span>
|
116
|
+
|
117
|
+
</li>
|
118
|
+
|
119
|
+
|
120
|
+
<li class="public ">
|
121
|
+
<span class="summary_signature">
|
122
|
+
|
123
|
+
<a href="#send_mail-instance_method" title="#send_mail (instance method)">- (Object) <strong>send_mail</strong>(mail) </a>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
</span>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
<span class="summary_desc"><div class='inline'><p>Send a response mail back on the wire of buffer.</p></div></span>
|
137
|
+
|
138
|
+
</li>
|
139
|
+
|
140
|
+
|
141
|
+
<li class="public ">
|
142
|
+
<span class="summary_signature">
|
143
|
+
|
144
|
+
<a href="#unbind-instance_method" title="#unbind (instance method)">- (Object) <strong>unbind</strong> </a>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
</span>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<span class="summary_desc"><div class='inline'><p>Handler for client disconnect.</p></div></span>
|
158
|
+
|
159
|
+
</li>
|
160
|
+
|
161
|
+
|
162
|
+
</ul>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<div id="instance_method_details" class="method_details_list">
|
168
|
+
<h2>Instance Method Details</h2>
|
169
|
+
|
170
|
+
|
171
|
+
<div class="method_details first">
|
172
|
+
<p class="signature first" id="post_init-instance_method">
|
173
|
+
|
174
|
+
- (<tt>Object</tt>) <strong>post_init</strong>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
</p><div class="docstring">
|
179
|
+
<div class="discussion">
|
180
|
+
<p>Initialize the first recieving envelope for the connection and create the service cache since each connection gets it’s own service instance.</p>
|
181
|
+
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
<div class="tags">
|
185
|
+
|
186
|
+
</div><table class="source_code">
|
187
|
+
<tr>
|
188
|
+
<td>
|
189
|
+
<pre class="lines">
|
190
|
+
|
191
|
+
|
192
|
+
4
|
193
|
+
5
|
194
|
+
6
|
195
|
+
7</pre>
|
196
|
+
</td>
|
197
|
+
<td>
|
198
|
+
<pre class="code"><span class="info file"># File 'lib/marilyn-rpc/server.rb', line 4</span>
|
199
|
+
|
200
|
+
<span class='def def kw'>def</span> <span class='post_init identifier id'>post_init</span>
|
201
|
+
<span class='@envelope ivar id'>@envelope</span> <span class='assign token'>=</span> <span class='MarilynRPC constant id'>MarilynRPC</span><span class='colon2 op'>::</span><span class='Envelope constant id'>Envelope</span><span class='dot token'>.</span><span class='new identifier id'>new</span>
|
202
|
+
<span class='@cache ivar id'>@cache</span> <span class='assign token'>=</span> <span class='MarilynRPC constant id'>MarilynRPC</span><span class='colon2 op'>::</span><span class='ServiceCache constant id'>ServiceCache</span><span class='dot token'>.</span><span class='new identifier id'>new</span>
|
203
|
+
<span class='end end kw'>end</span>
|
204
|
+
</pre>
|
205
|
+
</td>
|
206
|
+
</tr>
|
207
|
+
</table>
|
208
|
+
</div>
|
209
|
+
|
210
|
+
<div class="method_details ">
|
211
|
+
<p class="signature " id="receive_data-instance_method">
|
212
|
+
|
213
|
+
- (<tt>Object</tt>) <strong>receive_data</strong>(data)
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
</p><div class="docstring">
|
218
|
+
<div class="discussion">
|
219
|
+
<p>Handler for the incoming data. EventMachine compatible.</p>
|
220
|
+
|
221
|
+
</div>
|
222
|
+
</div>
|
223
|
+
<div class="tags">
|
224
|
+
<h3>Parameters:</h3>
|
225
|
+
<ul class="param">
|
226
|
+
|
227
|
+
<li>
|
228
|
+
|
229
|
+
<span class='type'>(<tt>String</tt>)</span>
|
230
|
+
|
231
|
+
|
232
|
+
<span class='name'>data</span>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
—
|
237
|
+
<div class='inline'><p>the data that should be parsed into envelopes</p></div>
|
238
|
+
|
239
|
+
</li>
|
240
|
+
|
241
|
+
</ul>
|
242
|
+
|
243
|
+
</div><table class="source_code">
|
244
|
+
<tr>
|
245
|
+
<td>
|
246
|
+
<pre class="lines">
|
247
|
+
|
248
|
+
|
249
|
+
11
|
250
|
+
12
|
251
|
+
13
|
252
|
+
14
|
253
|
+
15
|
254
|
+
16
|
255
|
+
17
|
256
|
+
18
|
257
|
+
19
|
258
|
+
20
|
259
|
+
21
|
260
|
+
22
|
261
|
+
23
|
262
|
+
24
|
263
|
+
25
|
264
|
+
26
|
265
|
+
27
|
266
|
+
28
|
267
|
+
29
|
268
|
+
30
|
269
|
+
31
|
270
|
+
32</pre>
|
271
|
+
</td>
|
272
|
+
<td>
|
273
|
+
<pre class="code"><span class="info file"># File 'lib/marilyn-rpc/server.rb', line 11</span>
|
274
|
+
|
275
|
+
<span class='def def kw'>def</span> <span class='receive_data identifier id'>receive_data</span><span class='lparen token'>(</span><span class='data identifier id'>data</span><span class='rparen token'>)</span>
|
276
|
+
<span class='overhang identifier id'>overhang</span> <span class='assign token'>=</span> <span class='@envelope ivar id'>@envelope</span><span class='dot token'>.</span><span class='parse! fid id'>parse!</span><span class='lparen token'>(</span><span class='data identifier id'>data</span><span class='rparen token'>)</span>
|
277
|
+
|
278
|
+
<span class='comment val'># was massage parsed successfully?</span>
|
279
|
+
<span class='if if kw'>if</span> <span class='@envelope ivar id'>@envelope</span><span class='dot token'>.</span><span class='finished? fid id'>finished?</span>
|
280
|
+
<span class='begin begin kw'>begin</span>
|
281
|
+
<span class='comment val'># grep the request</span>
|
282
|
+
<span class='answer identifier id'>answer</span> <span class='assign token'>=</span> <span class='@cache ivar id'>@cache</span><span class='dot token'>.</span><span class='call identifier id'>call</span><span class='lparen token'>(</span><span class='MarilynRPC constant id'>MarilynRPC</span><span class='colon2 op'>::</span><span class='MailFactory constant id'>MailFactory</span><span class='dot token'>.</span><span class='unpack identifier id'>unpack</span><span class='lparen token'>(</span><span class='@envelope ivar id'>@envelope</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
283
|
+
<span class='if if kw'>if</span> <span class='answer identifier id'>answer</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span> <span class='MarilynRPC constant id'>MarilynRPC</span><span class='colon2 op'>::</span><span class='CallResponseMail constant id'>CallResponseMail</span>
|
284
|
+
<span class='send_mail identifier id'>send_mail</span><span class='lparen token'>(</span><span class='answer identifier id'>answer</span><span class='rparen token'>)</span>
|
285
|
+
<span class='else else kw'>else</span>
|
286
|
+
<span class='answer identifier id'>answer</span><span class='dot token'>.</span><span class='connection identifier id'>connection</span> <span class='assign token'>=</span> <span class='self self kw'>self</span> <span class='comment val'># pass connection for async responses</span>
|
287
|
+
<span class='end end kw'>end</span>
|
288
|
+
<span class='rescue rescue kw'>rescue</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='exception identifier id'>exception</span>
|
289
|
+
<span class='send_mail identifier id'>send_mail</span><span class='lparen token'>(</span><span class='MarilynRPC constant id'>MarilynRPC</span><span class='colon2 op'>::</span><span class='ExceptionMail constant id'>ExceptionMail</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='exception identifier id'>exception</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
290
|
+
<span class='end end kw'>end</span>
|
291
|
+
|
292
|
+
<span class='comment val'># initialize the next envelope</span>
|
293
|
+
<span class='@envelope ivar id'>@envelope</span> <span class='assign token'>=</span> <span class='MarilynRPC constant id'>MarilynRPC</span><span class='colon2 op'>::</span><span class='Envelope constant id'>Envelope</span><span class='dot token'>.</span><span class='new identifier id'>new</span>
|
294
|
+
<span class='receive_data identifier id'>receive_data</span><span class='lparen token'>(</span><span class='overhang identifier id'>overhang</span><span class='rparen token'>)</span> <span class='if if_mod kw'>if</span> <span class='overhang identifier id'>overhang</span> <span class='comment val'># reenter the data loop</span>
|
295
|
+
<span class='end end kw'>end</span>
|
296
|
+
<span class='end end kw'>end</span>
|
297
|
+
</pre>
|
298
|
+
</td>
|
299
|
+
</tr>
|
300
|
+
</table>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
<div class="method_details ">
|
304
|
+
<p class="signature " id="send_mail-instance_method">
|
305
|
+
|
306
|
+
- (<tt>Object</tt>) <strong>send_mail</strong>(mail)
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
</p><div class="docstring">
|
311
|
+
<div class="discussion">
|
312
|
+
<p>Send a response mail back on the wire of buffer</p>
|
313
|
+
|
314
|
+
</div>
|
315
|
+
</div>
|
316
|
+
<div class="tags">
|
317
|
+
<h3>Parameters:</h3>
|
318
|
+
<ul class="param">
|
319
|
+
|
320
|
+
<li>
|
321
|
+
|
322
|
+
<span class='type'>(<tt><span class='object_link'><a href="ExceptionMail.html" title="MarilynRPC::ExceptionMail (class)">MarilynRPC::ExceptionMail</a></span></tt>, <tt><span class='object_link'><a href="CallResponseMail.html" title="MarilynRPC::CallResponseMail (class)">MarilynRPC::CallResponseMail</a></span></tt>)</span>
|
323
|
+
|
324
|
+
|
325
|
+
<span class='name'>mail</span>
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
—
|
330
|
+
<div class='inline'><p>the mail that should be send to the client</p></div>
|
331
|
+
|
332
|
+
</li>
|
333
|
+
|
334
|
+
</ul>
|
335
|
+
|
336
|
+
</div><table class="source_code">
|
337
|
+
<tr>
|
338
|
+
<td>
|
339
|
+
<pre class="lines">
|
340
|
+
|
341
|
+
|
342
|
+
37
|
343
|
+
38
|
344
|
+
39</pre>
|
345
|
+
</td>
|
346
|
+
<td>
|
347
|
+
<pre class="code"><span class="info file"># File 'lib/marilyn-rpc/server.rb', line 37</span>
|
348
|
+
|
349
|
+
<span class='def def kw'>def</span> <span class='send_mail identifier id'>send_mail</span><span class='lparen token'>(</span><span class='mail identifier id'>mail</span><span class='rparen token'>)</span>
|
350
|
+
<span class='send_data identifier id'>send_data</span><span class='lparen token'>(</span><span class='MarilynRPC constant id'>MarilynRPC</span><span class='colon2 op'>::</span><span class='Envelope constant id'>Envelope</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='mail identifier id'>mail</span><span class='dot token'>.</span><span class='encode identifier id'>encode</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='encode identifier id'>encode</span><span class='rparen token'>)</span>
|
351
|
+
<span class='end end kw'>end</span>
|
352
|
+
</pre>
|
353
|
+
</td>
|
354
|
+
</tr>
|
355
|
+
</table>
|
356
|
+
</div>
|
357
|
+
|
358
|
+
<div class="method_details ">
|
359
|
+
<p class="signature " id="unbind-instance_method">
|
360
|
+
|
361
|
+
- (<tt>Object</tt>) <strong>unbind</strong>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
</p><div class="docstring">
|
366
|
+
<div class="discussion">
|
367
|
+
<p>Handler for client disconnect</p>
|
368
|
+
|
369
|
+
</div>
|
370
|
+
</div>
|
371
|
+
<div class="tags">
|
372
|
+
|
373
|
+
</div><table class="source_code">
|
374
|
+
<tr>
|
375
|
+
<td>
|
376
|
+
<pre class="lines">
|
377
|
+
|
378
|
+
|
379
|
+
42
|
380
|
+
43
|
381
|
+
44</pre>
|
382
|
+
</td>
|
383
|
+
<td>
|
384
|
+
<pre class="code"><span class="info file"># File 'lib/marilyn-rpc/server.rb', line 42</span>
|
385
|
+
|
386
|
+
<span class='def def kw'>def</span> <span class='unbind identifier id'>unbind</span>
|
387
|
+
<span class='@cache ivar id'>@cache</span><span class='dot token'>.</span><span class='call_after_disconnect_callbacks! fid id'>call_after_disconnect_callbacks!</span>
|
388
|
+
<span class='end end kw'>end</span>
|
389
|
+
</pre>
|
390
|
+
</td>
|
391
|
+
</tr>
|
392
|
+
</table>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
</div>
|
396
|
+
|
397
|
+
</div>
|
398
|
+
|
399
|
+
<div id="footer">
|
400
|
+
Generated on Wed Jun 8 18:26:45 2011 by
|
401
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
402
|
+
0.6.8 (ruby-1.8.7).
|
403
|
+
</div>
|
404
|
+
|
405
|
+
</body>
|
406
|
+
</html>
|