roma-client 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{CHANGELOG → CHANGELOG.md} +8 -5
- data/Gemfile.lock +23 -15
- data/README.md +62 -0
- data/Rakefile +3 -3
- data/doc/CHANGELOG_md.html +119 -0
- data/doc/README_md.html +161 -0
- data/doc/Roma/Client/ClientPool.html +716 -0
- data/doc/Roma/Client/ClientRoutingTable.html +495 -0
- data/doc/Roma/Client/ConPool.html +484 -0
- data/doc/Roma/Client/Plugin/Alist.html +1276 -0
- data/doc/Roma/Client/Plugin/Map.html +531 -0
- data/doc/Roma/Client/Plugin/MapCount.html +401 -0
- data/doc/Roma/Client/Plugin.html +95 -0
- data/doc/Roma/Client/Proxy/ClientHandler.html +273 -0
- data/doc/Roma/Client/Proxy/Conpool.html +394 -0
- data/doc/Roma/Client/Proxy/Daemon.html +305 -0
- data/doc/Roma/Client/Proxy/RomaHandler.html +217 -0
- data/doc/Roma/Client/Proxy.html +95 -0
- data/doc/Roma/Client/RomaClient.html +1339 -0
- data/doc/Roma/Client/Sender.html +482 -0
- data/doc/Roma/Client/Stats.html +162 -0
- data/doc/Roma/Client/VERSION.html +141 -0
- data/doc/Roma/Client.html +95 -0
- data/doc/Roma/Logging/RLogger/ExtLogDev.html +159 -0
- data/doc/Roma/Logging/RLogger/ExtShiftAge.html +95 -0
- data/doc/Roma/Logging/RLogger/ExtTrace.html +109 -0
- data/doc/Roma/Logging/RLogger/Severity.html +139 -0
- data/doc/Roma/Logging/RLogger.html +786 -0
- data/doc/Roma/Logging.html +95 -0
- data/doc/Roma/Routing/RoutingData/RandomNodeListMaker.html +311 -0
- data/doc/Roma/Routing/RoutingData.html +912 -0
- data/doc/Roma/Routing.html +95 -0
- data/doc/Roma.html +95 -0
- data/doc/created.rid +20 -0
- data/doc/css/fonts.css +167 -0
- data/doc/css/rdoc.css +590 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +210 -0
- data/doc/js/darkfish.js +161 -0
- data/doc/js/jquery.js +4 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +109 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +228 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +972 -0
- data/lib/roma/client/rclient.rb +2 -1
- data/lib/roma/client/sender.rb +2 -2
- data/lib/roma/client/version.rb +1 -1
- data/lib/roma/client.rb +0 -21
- metadata +84 -10
- data/README +0 -17
@@ -0,0 +1,273 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset=" UTF-8">
|
6
|
+
|
7
|
+
<title>module Roma::Client::Proxy::ClientHandler - ROMA documents</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../../../";
|
11
|
+
</script>
|
12
|
+
|
13
|
+
<script src="../../../js/jquery.js"></script>
|
14
|
+
<script src="../../../js/darkfish.js"></script>
|
15
|
+
|
16
|
+
<link href="../../../css/fonts.css" rel="stylesheet">
|
17
|
+
<link href="../../../css/rdoc.css" rel="stylesheet">
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
<body id="top" role="document" class="module">
|
22
|
+
<nav role="navigation">
|
23
|
+
<div id="project-navigation">
|
24
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
+
<h2>
|
26
|
+
<a href="../../../index.html" rel="home">Home</a>
|
27
|
+
</h2>
|
28
|
+
|
29
|
+
<div id="table-of-contents-navigation">
|
30
|
+
<a href="../../../table_of_contents.html#pages">Pages</a>
|
31
|
+
<a href="../../../table_of_contents.html#classes">Classes</a>
|
32
|
+
<a href="../../../table_of_contents.html#methods">Methods</a>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
+
<form action="#" method="get" accept-charset="utf-8">
|
38
|
+
<div id="search-field-wrapper">
|
39
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
+
aria-autocomplete="list" aria-controls="search-results"
|
41
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<ul id="search-results" aria-label="Search Results"
|
46
|
+
aria-busy="false" aria-expanded="false"
|
47
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
+
</form>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
<div id="class-metadata">
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<!-- Method Quickref -->
|
61
|
+
<div id="method-list-section" class="nav-section">
|
62
|
+
<h3>Methods</h3>
|
63
|
+
|
64
|
+
<ul class="link-list" role="directory">
|
65
|
+
|
66
|
+
<li ><a href="#method-i-get_roma_handler">#get_roma_handler</a>
|
67
|
+
|
68
|
+
<li ><a href="#method-i-post_init">#post_init</a>
|
69
|
+
|
70
|
+
<li ><a href="#method-i-receive_data">#receive_data</a>
|
71
|
+
|
72
|
+
<li ><a href="#method-i-unbind">#unbind</a>
|
73
|
+
|
74
|
+
</ul>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
</div>
|
78
|
+
</nav>
|
79
|
+
|
80
|
+
<main role="main" aria-labelledby="module-Roma::Client::Proxy::ClientHandler">
|
81
|
+
<h1 id="module-Roma::Client::Proxy::ClientHandler" class="module">
|
82
|
+
module Roma::Client::Proxy::ClientHandler
|
83
|
+
</h1>
|
84
|
+
|
85
|
+
<section class="description">
|
86
|
+
|
87
|
+
</section>
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
103
|
+
<header>
|
104
|
+
<h3>Public Instance Methods</h3>
|
105
|
+
</header>
|
106
|
+
|
107
|
+
|
108
|
+
<div id="method-i-get_roma_handler" class="method-detail ">
|
109
|
+
|
110
|
+
<div class="method-heading">
|
111
|
+
<span class="method-name">get_roma_handler</span><span
|
112
|
+
class="method-args">(cmd_line)</span>
|
113
|
+
|
114
|
+
<span class="method-click-advice">click to toggle source</span>
|
115
|
+
|
116
|
+
</div>
|
117
|
+
|
118
|
+
|
119
|
+
<div class="method-description">
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<div class="method-source-code" id="get_roma_handler-source">
|
127
|
+
<pre><span class="ruby-comment"># File lib/roma/client/proxy/daemon.rb, line 63</span>
|
128
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_roma_handler</span>(<span class="ruby-identifier">cmd_line</span>)
|
129
|
+
<span class="ruby-identifier">cmd</span>, <span class="ruby-identifier">key_hname</span> = <span class="ruby-identifier">cmd_line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">' '</span>)
|
130
|
+
<span class="ruby-identifier">key</span>, <span class="ruby-identifier">hname</span> = <span class="ruby-identifier">key_hname</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">"\e"</span>)
|
131
|
+
<span class="ruby-identifier">nid</span>, <span class="ruby-identifier">d</span> = <span class="ruby-constant">Daemon</span><span class="ruby-operator">::</span><span class="ruby-identifier">rttable</span>.<span class="ruby-identifier">search_node</span>(<span class="ruby-identifier">key</span>)
|
132
|
+
<span class="ruby-constant">Conpool</span><span class="ruby-operator">::</span><span class="ruby-identifier">instance</span>.<span class="ruby-identifier">get_connection</span>(<span class="ruby-identifier">nid</span>, <span class="ruby-constant">RomaHandler</span>)
|
133
|
+
<span class="ruby-keyword">rescue</span> =<span class="ruby-operator">></span><span class="ruby-identifier">e</span>
|
134
|
+
<span class="ruby-identifier">$log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-node">"#{e} #{$@}"</span>)
|
135
|
+
<span class="ruby-keyword">end</span></pre>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
<div id="method-i-post_init" class="method-detail ">
|
147
|
+
|
148
|
+
<div class="method-heading">
|
149
|
+
<span class="method-name">post_init</span><span
|
150
|
+
class="method-args">()</span>
|
151
|
+
|
152
|
+
<span class="method-click-advice">click to toggle source</span>
|
153
|
+
|
154
|
+
</div>
|
155
|
+
|
156
|
+
|
157
|
+
<div class="method-description">
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
<div class="method-source-code" id="post_init-source">
|
165
|
+
<pre><span class="ruby-comment"># File lib/roma/client/proxy/daemon.rb, line 34</span>
|
166
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">post_init</span>
|
167
|
+
<span class="ruby-identifier">$log</span>.<span class="ruby-identifier">info</span>(<span class="ruby-string">"Connected from client"</span>)
|
168
|
+
<span class="ruby-ivar">@cmd</span> = <span class="ruby-string">''</span>
|
169
|
+
<span class="ruby-keyword">end</span></pre>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
</div>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
<div id="method-i-receive_data" class="method-detail ">
|
181
|
+
|
182
|
+
<div class="method-heading">
|
183
|
+
<span class="method-name">receive_data</span><span
|
184
|
+
class="method-args">(data)</span>
|
185
|
+
|
186
|
+
<span class="method-click-advice">click to toggle source</span>
|
187
|
+
|
188
|
+
</div>
|
189
|
+
|
190
|
+
|
191
|
+
<div class="method-description">
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
<div class="method-source-code" id="receive_data-source">
|
199
|
+
<pre><span class="ruby-comment"># File lib/roma/client/proxy/daemon.rb, line 39</span>
|
200
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">receive_data</span>(<span class="ruby-identifier">data</span>)
|
201
|
+
<span class="ruby-ivar">@cmd</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">data</span>
|
202
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@cmd</span>.<span class="ruby-identifier">index</span>(<span class="ruby-string">"\n"</span>)
|
203
|
+
<span class="ruby-ivar">@roma_h</span> = <span class="ruby-identifier">get_roma_handler</span>(<span class="ruby-ivar">@cmd</span>)
|
204
|
+
<span class="ruby-ivar">@roma_h</span>.<span class="ruby-identifier">send_data</span>(<span class="ruby-ivar">@cmd</span>)
|
205
|
+
<span class="ruby-ivar">@cmd</span> = <span class="ruby-string">''</span>
|
206
|
+
<span class="ruby-constant">EM</span><span class="ruby-operator">::</span><span class="ruby-identifier">enable_proxy</span>(<span class="ruby-keyword">self</span>, <span class="ruby-ivar">@roma_h</span>)
|
207
|
+
<span class="ruby-constant">EM</span><span class="ruby-operator">::</span><span class="ruby-identifier">enable_proxy</span>(<span class="ruby-ivar">@roma_h</span>, <span class="ruby-keyword">self</span>)
|
208
|
+
<span class="ruby-keyword">end</span>
|
209
|
+
<span class="ruby-keyword">rescue</span> =<span class="ruby-operator">></span><span class="ruby-identifier">e</span>
|
210
|
+
<span class="ruby-identifier">$log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-node">"#{e} #{$@}"</span>)
|
211
|
+
<span class="ruby-keyword">end</span></pre>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
</div>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
<div id="method-i-unbind" class="method-detail ">
|
223
|
+
|
224
|
+
<div class="method-heading">
|
225
|
+
<span class="method-name">unbind</span><span
|
226
|
+
class="method-args">()</span>
|
227
|
+
|
228
|
+
<span class="method-click-advice">click to toggle source</span>
|
229
|
+
|
230
|
+
</div>
|
231
|
+
|
232
|
+
|
233
|
+
<div class="method-description">
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<div class="method-source-code" id="unbind-source">
|
241
|
+
<pre><span class="ruby-comment"># File lib/roma/client/proxy/daemon.rb, line 52</span>
|
242
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">unbind</span>
|
243
|
+
<span class="ruby-identifier">$log</span>.<span class="ruby-identifier">info</span>(<span class="ruby-string">"Disconnected from client"</span>)
|
244
|
+
<span class="ruby-constant">EM</span><span class="ruby-operator">::</span><span class="ruby-identifier">disable_proxy</span>(<span class="ruby-keyword">self</span>)
|
245
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@roma_h</span>
|
246
|
+
<span class="ruby-constant">EM</span><span class="ruby-operator">::</span><span class="ruby-identifier">disable_proxy</span>(<span class="ruby-ivar">@roma_h</span>)
|
247
|
+
<span class="ruby-constant">Conpool</span><span class="ruby-operator">::</span><span class="ruby-identifier">instance</span>.<span class="ruby-identifier">return_connection</span>(<span class="ruby-ivar">@roma_h</span>)
|
248
|
+
<span class="ruby-keyword">end</span>
|
249
|
+
<span class="ruby-keyword">rescue</span> =<span class="ruby-operator">></span><span class="ruby-identifier">e</span>
|
250
|
+
<span class="ruby-identifier">$log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-node">"#{e} #{$@}"</span>)
|
251
|
+
<span class="ruby-keyword">end</span></pre>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
</div>
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
</div>
|
260
|
+
|
261
|
+
|
262
|
+
</section>
|
263
|
+
|
264
|
+
</section>
|
265
|
+
</main>
|
266
|
+
|
267
|
+
|
268
|
+
<footer id="validator-badges" role="contentinfo">
|
269
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
270
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
271
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
272
|
+
</footer>
|
273
|
+
|
@@ -0,0 +1,394 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset=" UTF-8">
|
6
|
+
|
7
|
+
<title>class Roma::Client::Proxy::Conpool - ROMA documents</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../../../";
|
11
|
+
</script>
|
12
|
+
|
13
|
+
<script src="../../../js/jquery.js"></script>
|
14
|
+
<script src="../../../js/darkfish.js"></script>
|
15
|
+
|
16
|
+
<link href="../../../css/fonts.css" rel="stylesheet">
|
17
|
+
<link href="../../../css/rdoc.css" rel="stylesheet">
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
<body id="top" role="document" class="class">
|
22
|
+
<nav role="navigation">
|
23
|
+
<div id="project-navigation">
|
24
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
+
<h2>
|
26
|
+
<a href="../../../index.html" rel="home">Home</a>
|
27
|
+
</h2>
|
28
|
+
|
29
|
+
<div id="table-of-contents-navigation">
|
30
|
+
<a href="../../../table_of_contents.html#pages">Pages</a>
|
31
|
+
<a href="../../../table_of_contents.html#classes">Classes</a>
|
32
|
+
<a href="../../../table_of_contents.html#methods">Methods</a>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
+
<form action="#" method="get" accept-charset="utf-8">
|
38
|
+
<div id="search-field-wrapper">
|
39
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
+
aria-autocomplete="list" aria-controls="search-results"
|
41
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<ul id="search-results" aria-label="Search Results"
|
46
|
+
aria-busy="false" aria-expanded="false"
|
47
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
+
</form>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
<div id="class-metadata">
|
56
|
+
|
57
|
+
<div id="parent-class-section" class="nav-section">
|
58
|
+
<h3>Parent</h3>
|
59
|
+
|
60
|
+
|
61
|
+
<p class="link">Object
|
62
|
+
|
63
|
+
</div>
|
64
|
+
|
65
|
+
<div id="includes-section" class="nav-section">
|
66
|
+
<h3>Included Modules</h3>
|
67
|
+
|
68
|
+
<ul class="link-list">
|
69
|
+
|
70
|
+
|
71
|
+
<li><span class="include">Singleton</span>
|
72
|
+
|
73
|
+
|
74
|
+
</ul>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
|
78
|
+
<!-- Method Quickref -->
|
79
|
+
<div id="method-list-section" class="nav-section">
|
80
|
+
<h3>Methods</h3>
|
81
|
+
|
82
|
+
<ul class="link-list" role="directory">
|
83
|
+
|
84
|
+
<li ><a href="#method-c-new">::new</a>
|
85
|
+
|
86
|
+
<li ><a href="#method-i-close_all">#close_all</a>
|
87
|
+
|
88
|
+
<li ><a href="#method-i-close_at">#close_at</a>
|
89
|
+
|
90
|
+
<li ><a href="#method-i-create_connection">#create_connection</a>
|
91
|
+
|
92
|
+
<li ><a href="#method-i-get_connection">#get_connection</a>
|
93
|
+
|
94
|
+
<li ><a href="#method-i-return_connection">#return_connection</a>
|
95
|
+
|
96
|
+
</ul>
|
97
|
+
</div>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
</nav>
|
101
|
+
|
102
|
+
<main role="main" aria-labelledby="class-Roma::Client::Proxy::Conpool">
|
103
|
+
<h1 id="class-Roma::Client::Proxy::Conpool" class="class">
|
104
|
+
class Roma::Client::Proxy::Conpool
|
105
|
+
</h1>
|
106
|
+
|
107
|
+
<section class="description">
|
108
|
+
|
109
|
+
</section>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
<section class="attribute-method-details" class="method-section">
|
123
|
+
<header>
|
124
|
+
<h3>Attributes</h3>
|
125
|
+
</header>
|
126
|
+
|
127
|
+
|
128
|
+
<div id="attribute-i-maxlength" class="method-detail">
|
129
|
+
<div class="method-heading attribute-method-heading">
|
130
|
+
<span class="method-name">maxlength</span><span
|
131
|
+
class="attribute-access-type">[RW]</span>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<div class="method-description">
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
</section>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
146
|
+
<header>
|
147
|
+
<h3>Public Class Methods</h3>
|
148
|
+
</header>
|
149
|
+
|
150
|
+
|
151
|
+
<div id="method-c-new" class="method-detail ">
|
152
|
+
|
153
|
+
<div class="method-heading">
|
154
|
+
<span class="method-name">new</span><span
|
155
|
+
class="method-args">()</span>
|
156
|
+
|
157
|
+
<span class="method-click-advice">click to toggle source</span>
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
<div class="method-description">
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<div class="method-source-code" id="new-source">
|
170
|
+
<pre><span class="ruby-comment"># File lib/roma/client/proxy/daemon.rb, line 79</span>
|
171
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
|
172
|
+
<span class="ruby-ivar">@pool</span> = {}
|
173
|
+
<span class="ruby-ivar">@maxlength</span> = <span class="ruby-value">10</span>
|
174
|
+
<span class="ruby-ivar">@lock</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
|
175
|
+
<span class="ruby-keyword">end</span></pre>
|
176
|
+
</div>
|
177
|
+
|
178
|
+
</div>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
</div>
|
184
|
+
|
185
|
+
|
186
|
+
</section>
|
187
|
+
|
188
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
189
|
+
<header>
|
190
|
+
<h3>Public Instance Methods</h3>
|
191
|
+
</header>
|
192
|
+
|
193
|
+
|
194
|
+
<div id="method-i-close_all" class="method-detail ">
|
195
|
+
|
196
|
+
<div class="method-heading">
|
197
|
+
<span class="method-name">close_all</span><span
|
198
|
+
class="method-args">()</span>
|
199
|
+
|
200
|
+
<span class="method-click-advice">click to toggle source</span>
|
201
|
+
|
202
|
+
</div>
|
203
|
+
|
204
|
+
|
205
|
+
<div class="method-description">
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
<div class="method-source-code" id="close_all-source">
|
213
|
+
<pre><span class="ruby-comment"># File lib/roma/client/proxy/daemon.rb, line 111</span>
|
214
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">close_all</span>
|
215
|
+
<span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">each_key</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">ap</span><span class="ruby-operator">|</span> <span class="ruby-identifier">close_at</span>(<span class="ruby-identifier">ap</span>) }
|
216
|
+
<span class="ruby-keyword">end</span></pre>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
</div>
|
225
|
+
|
226
|
+
|
227
|
+
<div id="method-i-close_at" class="method-detail ">
|
228
|
+
|
229
|
+
<div class="method-heading">
|
230
|
+
<span class="method-name">close_at</span><span
|
231
|
+
class="method-args">(ap)</span>
|
232
|
+
|
233
|
+
<span class="method-click-advice">click to toggle source</span>
|
234
|
+
|
235
|
+
</div>
|
236
|
+
|
237
|
+
|
238
|
+
<div class="method-description">
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
<div class="method-source-code" id="close_at-source">
|
246
|
+
<pre><span class="ruby-comment"># File lib/roma/client/proxy/daemon.rb, line 115</span>
|
247
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">close_at</span>(<span class="ruby-identifier">ap</span>)
|
248
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">ap</span>)
|
249
|
+
<span class="ruby-ivar">@lock</span>.<span class="ruby-identifier">synchronize</span> {
|
250
|
+
<span class="ruby-keyword">while</span>(<span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>)
|
251
|
+
<span class="ruby-keyword">begin</span>
|
252
|
+
<span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">shift</span>.<span class="ruby-identifier">close_connection</span>
|
253
|
+
<span class="ruby-keyword">rescue</span> =<span class="ruby-operator">></span><span class="ruby-identifier">e</span>
|
254
|
+
<span class="ruby-identifier">$log</span>.<span class="ruby-identifier">error</span>(<span class="ruby-node">"#{e} #{$@}"</span>)
|
255
|
+
<span class="ruby-keyword">end</span>
|
256
|
+
<span class="ruby-keyword">end</span>
|
257
|
+
<span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">ap</span>)
|
258
|
+
}
|
259
|
+
<span class="ruby-keyword">end</span></pre>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
</div>
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
</div>
|
268
|
+
|
269
|
+
|
270
|
+
<div id="method-i-create_connection" class="method-detail ">
|
271
|
+
|
272
|
+
<div class="method-heading">
|
273
|
+
<span class="method-name">create_connection</span><span
|
274
|
+
class="method-args">(ap, handler)</span>
|
275
|
+
|
276
|
+
<span class="method-click-advice">click to toggle source</span>
|
277
|
+
|
278
|
+
</div>
|
279
|
+
|
280
|
+
|
281
|
+
<div class="method-description">
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
<div class="method-source-code" id="create_connection-source">
|
289
|
+
<pre><span class="ruby-comment"># File lib/roma/client/proxy/daemon.rb, line 104</span>
|
290
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_connection</span>(<span class="ruby-identifier">ap</span>, <span class="ruby-identifier">handler</span>)
|
291
|
+
<span class="ruby-identifier">addr</span>,<span class="ruby-identifier">port</span> = <span class="ruby-identifier">ap</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'_'</span>)
|
292
|
+
<span class="ruby-identifier">con</span> = <span class="ruby-constant">EventMachine</span><span class="ruby-operator">::</span><span class="ruby-identifier">connect</span>(<span class="ruby-identifier">addr</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">handler</span>)
|
293
|
+
<span class="ruby-identifier">con</span>.<span class="ruby-identifier">ap</span> = <span class="ruby-identifier">ap</span>
|
294
|
+
<span class="ruby-identifier">con</span>
|
295
|
+
<span class="ruby-keyword">end</span></pre>
|
296
|
+
</div>
|
297
|
+
|
298
|
+
</div>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
</div>
|
304
|
+
|
305
|
+
|
306
|
+
<div id="method-i-get_connection" class="method-detail ">
|
307
|
+
|
308
|
+
<div class="method-heading">
|
309
|
+
<span class="method-name">get_connection</span><span
|
310
|
+
class="method-args">(ap, handler)</span>
|
311
|
+
|
312
|
+
<span class="method-click-advice">click to toggle source</span>
|
313
|
+
|
314
|
+
</div>
|
315
|
+
|
316
|
+
|
317
|
+
<div class="method-description">
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
<div class="method-source-code" id="get_connection-source">
|
325
|
+
<pre><span class="ruby-comment"># File lib/roma/client/proxy/daemon.rb, line 85</span>
|
326
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_connection</span>(<span class="ruby-identifier">ap</span>, <span class="ruby-identifier">handler</span>)
|
327
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">shift</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">ap</span>) <span class="ruby-operator">&&</span> <span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
328
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">create_connection</span>(<span class="ruby-identifier">ap</span>, <span class="ruby-identifier">handler</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>
|
329
|
+
<span class="ruby-identifier">ret</span>
|
330
|
+
<span class="ruby-keyword">end</span></pre>
|
331
|
+
</div>
|
332
|
+
|
333
|
+
</div>
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
</div>
|
339
|
+
|
340
|
+
|
341
|
+
<div id="method-i-return_connection" class="method-detail ">
|
342
|
+
|
343
|
+
<div class="method-heading">
|
344
|
+
<span class="method-name">return_connection</span><span
|
345
|
+
class="method-args">(con)</span>
|
346
|
+
|
347
|
+
<span class="method-click-advice">click to toggle source</span>
|
348
|
+
|
349
|
+
</div>
|
350
|
+
|
351
|
+
|
352
|
+
<div class="method-description">
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
<div class="method-source-code" id="return_connection-source">
|
360
|
+
<pre><span class="ruby-comment"># File lib/roma/client/proxy/daemon.rb, line 91</span>
|
361
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">return_connection</span>(<span class="ruby-identifier">con</span>)
|
362
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">con</span>.<span class="ruby-identifier">connected</span>
|
363
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">con</span>.<span class="ruby-identifier">ap</span>) <span class="ruby-operator">&&</span> <span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">con</span>.<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
364
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">con</span>.<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-ivar">@maxlength</span>
|
365
|
+
<span class="ruby-identifier">con</span>.<span class="ruby-identifier">close_connection</span>
|
366
|
+
<span class="ruby-keyword">else</span>
|
367
|
+
<span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">con</span>.<span class="ruby-identifier">ap</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">con</span>
|
368
|
+
<span class="ruby-keyword">end</span>
|
369
|
+
<span class="ruby-keyword">else</span>
|
370
|
+
<span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">con</span>.<span class="ruby-identifier">ap</span>] = [<span class="ruby-identifier">con</span>]
|
371
|
+
<span class="ruby-keyword">end</span>
|
372
|
+
<span class="ruby-keyword">end</span></pre>
|
373
|
+
</div>
|
374
|
+
|
375
|
+
</div>
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
</div>
|
381
|
+
|
382
|
+
|
383
|
+
</section>
|
384
|
+
|
385
|
+
</section>
|
386
|
+
</main>
|
387
|
+
|
388
|
+
|
389
|
+
<footer id="validator-badges" role="contentinfo">
|
390
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
391
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
392
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
393
|
+
</footer>
|
394
|
+
|