marilyn-rpc 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +39 -4
- data/examples/async/client.rb +0 -5
- data/examples/authentication/client.rb +18 -0
- data/examples/authentication/server.rb +30 -0
- data/lib/marilyn-rpc.rb +1 -1
- data/lib/marilyn-rpc/client.rb +21 -3
- data/lib/marilyn-rpc/error.rb +13 -0
- data/lib/marilyn-rpc/mails.rb +3 -3
- data/lib/marilyn-rpc/server.rb +6 -11
- data/lib/marilyn-rpc/service.rb +86 -11
- data/lib/marilyn-rpc/service_cache.rb +44 -23
- data/lib/marilyn-rpc/version.rb +1 -1
- data/spec/mails_spec.rb +2 -1
- data/spec/server_spec.rb +1 -1
- data/spec/service_cache_spec.rb +140 -0
- data/spec/service_spec.rb +56 -5
- data/spec/spec_helper.rb +5 -0
- metadata +10 -34
- data/doc/MarilynRPC.html +0 -108
- data/doc/MarilynRPC/CallRequestMail.html +0 -578
- data/doc/MarilynRPC/CallResponseMail.html +0 -418
- data/doc/MarilynRPC/Envelope.html +0 -705
- data/doc/MarilynRPC/ExceptionMail.html +0 -338
- data/doc/MarilynRPC/Gentleman.html +0 -658
- data/doc/MarilynRPC/MailFactory.html +0 -284
- data/doc/MarilynRPC/MailHelper.html +0 -489
- data/doc/MarilynRPC/NativeClient.html +0 -579
- data/doc/MarilynRPC/NativeClientProxy.html +0 -303
- data/doc/MarilynRPC/Server.html +0 -406
- data/doc/MarilynRPC/Service.html +0 -599
- data/doc/MarilynRPC/ServiceCache.html +0 -481
- data/doc/_index.html +0 -219
- data/doc/class_list.html +0 -36
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -53
- data/doc/css/style.css +0 -318
- data/doc/file.README.html +0 -154
- data/doc/file_list.html +0 -38
- data/doc/frames.html +0 -13
- data/doc/index.html +0 -154
- data/doc/js/app.js +0 -203
- data/doc/js/full_list.js +0 -149
- data/doc/js/jquery.js +0 -16
- data/doc/method_list.html +0 -467
- data/doc/top-level-namespace.html +0 -88
- data/spec/service_cache.rb +0 -45
@@ -1,303 +0,0 @@
|
|
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>Class: MarilynRPC::NativeClientProxy</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 (N)</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">NativeClientProxy</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>Class: MarilynRPC::NativeClientProxy
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
</h1>
|
51
|
-
|
52
|
-
<dl class="box">
|
53
|
-
|
54
|
-
<dt class="r1">Inherits:</dt>
|
55
|
-
<dd class="r1">
|
56
|
-
<span class="inheritName">Object</span>
|
57
|
-
|
58
|
-
<ul class="fullTree">
|
59
|
-
<li>Object</li>
|
60
|
-
|
61
|
-
<li class="next">MarilynRPC::NativeClientProxy</li>
|
62
|
-
|
63
|
-
</ul>
|
64
|
-
<a href="#" class="inheritanceTree">show all</a>
|
65
|
-
|
66
|
-
</dd>
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
<dt class="r2 last">Defined in:</dt>
|
77
|
-
<dd class="r2 last">lib/marilyn-rpc/client.rb</dd>
|
78
|
-
|
79
|
-
</dl>
|
80
|
-
<div class="clear"></div>
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
<h2>
|
87
|
-
Instance Method Summary
|
88
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
89
|
-
</h2>
|
90
|
-
|
91
|
-
<ul class="summary">
|
92
|
-
|
93
|
-
<li class="public ">
|
94
|
-
<span class="summary_signature">
|
95
|
-
|
96
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (NativeClientProxy) <strong>initialize</strong>(path, socket) </a>
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
</span>
|
101
|
-
|
102
|
-
<span class="note title constructor">constructor</span>
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
<span class="summary_desc"><div class='inline'><p>Creates a new Native client proxy, were the calls get send to the remote side.</p></div></span>
|
112
|
-
|
113
|
-
</li>
|
114
|
-
|
115
|
-
|
116
|
-
<li class="public ">
|
117
|
-
<span class="summary_signature">
|
118
|
-
|
119
|
-
<a href="#method_missing-instance_method" title="#method_missing (instance method)">- (Object) <strong>method_missing</strong>(method, *args, &block) </a>
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
</span>
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
<span class="summary_desc"><div class='inline'><p>Handler for calls to the remote system.</p></div></span>
|
133
|
-
|
134
|
-
</li>
|
135
|
-
|
136
|
-
|
137
|
-
</ul>
|
138
|
-
|
139
|
-
|
140
|
-
<div id="constructor_details" class="method_details_list">
|
141
|
-
<h2>Constructor Details</h2>
|
142
|
-
|
143
|
-
<div class="method_details first">
|
144
|
-
<p class="signature first" id="initialize-instance_method">
|
145
|
-
|
146
|
-
- (<tt><span class='object_link'><a href="" title="MarilynRPC::NativeClientProxy (class)">NativeClientProxy</a></span></tt>) <strong>initialize</strong>(path, socket)
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
</p><div class="docstring">
|
151
|
-
<div class="discussion">
|
152
|
-
<p>Creates a new Native client proxy, were the calls get send to the remote side.</p>
|
153
|
-
|
154
|
-
</div>
|
155
|
-
</div>
|
156
|
-
<div class="tags">
|
157
|
-
<h3>Parameters:</h3>
|
158
|
-
<ul class="param">
|
159
|
-
|
160
|
-
<li>
|
161
|
-
|
162
|
-
<span class='type'>(<tt>Object</tt>)</span>
|
163
|
-
|
164
|
-
|
165
|
-
<span class='name'>path</span>
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
—
|
170
|
-
<div class='inline'><p>the path that is used to identify the service</p></div>
|
171
|
-
|
172
|
-
</li>
|
173
|
-
|
174
|
-
<li>
|
175
|
-
|
176
|
-
<span class='type'>(<tt>Socekt</tt>)</span>
|
177
|
-
|
178
|
-
|
179
|
-
<span class='name'>socket</span>
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
—
|
184
|
-
<div class='inline'><p>the socket to use for communication</p></div>
|
185
|
-
|
186
|
-
</li>
|
187
|
-
|
188
|
-
</ul>
|
189
|
-
|
190
|
-
</div><table class="source_code">
|
191
|
-
<tr>
|
192
|
-
<td>
|
193
|
-
<pre class="lines">
|
194
|
-
|
195
|
-
|
196
|
-
9
|
197
|
-
10
|
198
|
-
11</pre>
|
199
|
-
</td>
|
200
|
-
<td>
|
201
|
-
<pre class="code"><span class="info file"># File 'lib/marilyn-rpc/client.rb', line 9</span>
|
202
|
-
|
203
|
-
<span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='path identifier id'>path</span><span class='comma token'>,</span> <span class='socket identifier id'>socket</span><span class='rparen token'>)</span>
|
204
|
-
<span class='@path ivar id'>@path</span><span class='comma token'>,</span> <span class='@socket ivar id'>@socket</span> <span class='assign token'>=</span> <span class='path identifier id'>path</span><span class='comma token'>,</span> <span class='socket identifier id'>socket</span>
|
205
|
-
<span class='end end kw'>end</span>
|
206
|
-
</pre>
|
207
|
-
</td>
|
208
|
-
</tr>
|
209
|
-
</table>
|
210
|
-
</div>
|
211
|
-
|
212
|
-
</div>
|
213
|
-
<div id="method_missing_details" class="method_details_list">
|
214
|
-
<h2>Dynamic Method Handling</h2>
|
215
|
-
<p class="notice this">
|
216
|
-
This class handles dynamic methods through the <tt>method_missing</tt> method
|
217
|
-
|
218
|
-
</p>
|
219
|
-
|
220
|
-
<div class="method_details first">
|
221
|
-
<p class="signature first" id="method_missing-instance_method">
|
222
|
-
|
223
|
-
- (<tt>Object</tt>) <strong>method_missing</strong>(method, *args, &block)
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
</p><div class="docstring">
|
228
|
-
<div class="discussion">
|
229
|
-
<p>Handler for calls to the remote system</p>
|
230
|
-
|
231
|
-
</div>
|
232
|
-
</div>
|
233
|
-
<div class="tags">
|
234
|
-
|
235
|
-
</div><table class="source_code">
|
236
|
-
<tr>
|
237
|
-
<td>
|
238
|
-
<pre class="lines">
|
239
|
-
|
240
|
-
|
241
|
-
14
|
242
|
-
15
|
243
|
-
16
|
244
|
-
17
|
245
|
-
18
|
246
|
-
19
|
247
|
-
20
|
248
|
-
21
|
249
|
-
22
|
250
|
-
23
|
251
|
-
24
|
252
|
-
25
|
253
|
-
26
|
254
|
-
27
|
255
|
-
28
|
256
|
-
29
|
257
|
-
30
|
258
|
-
31
|
259
|
-
32
|
260
|
-
33</pre>
|
261
|
-
</td>
|
262
|
-
<td>
|
263
|
-
<pre class="code"><span class="info file"># File 'lib/marilyn-rpc/client.rb', line 14</span>
|
264
|
-
|
265
|
-
<span class='def def kw'>def</span> <span class='method_missing identifier id'>method_missing</span><span class='lparen token'>(</span><span class='method identifier id'>method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&</span><span class='block identifier id'>block</span><span class='rparen token'>)</span>
|
266
|
-
<span class='comment val'># since this client can't multiplex, we set the tag to nil</span>
|
267
|
-
<span class='@socket ivar id'>@socket</span><span class='dot token'>.</span><span class='write identifier id'>write</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='build_call identifier id'>build_call</span><span class='lparen token'>(</span><span class='nil nil kw'>nil</span><span class='comma token'>,</span> <span class='@path ivar id'>@path</span><span class='comma token'>,</span> <span class='method identifier id'>method</span><span class='comma token'>,</span> <span class='args identifier id'>args</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
268
|
-
|
269
|
-
<span class='comment val'># read the answer of the server back in</span>
|
270
|
-
<span class='answer identifier id'>answer</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>
|
271
|
-
<span class='comment val'># read the header to have the size</span>
|
272
|
-
<span class='answer identifier id'>answer</span><span class='dot token'>.</span><span class='parse! fid id'>parse!</span><span class='lparen token'>(</span><span class='@socket ivar id'>@socket</span><span class='dot token'>.</span><span class='read identifier id'>read</span><span class='lparen token'>(</span><span class='integer val'>4</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
273
|
-
<span class='comment val'># so now that we know the site, read the rest of the envelope</span>
|
274
|
-
<span class='answer identifier id'>answer</span><span class='dot token'>.</span><span class='parse! fid id'>parse!</span><span class='lparen token'>(</span><span class='@socket ivar id'>@socket</span><span class='dot token'>.</span><span class='read identifier id'>read</span><span class='lparen token'>(</span><span class='answer identifier id'>answer</span><span class='dot token'>.</span><span class='size identifier id'>size</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
275
|
-
|
276
|
-
<span class='comment val'># returns the result part of the mail or raise the exception if there is </span>
|
277
|
-
<span class='comment val'># one</span>
|
278
|
-
<span class='mail identifier id'>mail</span> <span class='assign 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='answer identifier id'>answer</span><span class='rparen token'>)</span>
|
279
|
-
<span class='if if kw'>if</span> <span class='mail identifier id'>mail</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>
|
280
|
-
<span class='mail identifier id'>mail</span><span class='dot token'>.</span><span class='result identifier id'>result</span>
|
281
|
-
<span class='else else kw'>else</span>
|
282
|
-
<span class='raise identifier id'>raise</span> <span class='mail identifier id'>mail</span><span class='dot token'>.</span><span class='exception identifier id'>exception</span>
|
283
|
-
<span class='end end kw'>end</span>
|
284
|
-
<span class='end end kw'>end</span>
|
285
|
-
</pre>
|
286
|
-
</td>
|
287
|
-
</tr>
|
288
|
-
</table>
|
289
|
-
</div>
|
290
|
-
|
291
|
-
</div>
|
292
|
-
|
293
|
-
|
294
|
-
</div>
|
295
|
-
|
296
|
-
<div id="footer">
|
297
|
-
Generated on Wed Jun 8 18:26:45 2011 by
|
298
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
299
|
-
0.6.8 (ruby-1.8.7).
|
300
|
-
</div>
|
301
|
-
|
302
|
-
</body>
|
303
|
-
</html>
|
data/doc/MarilynRPC/Server.html
DELETED
@@ -1,406 +0,0 @@
|
|
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>
|