roma-client 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +22 -15
- data/Gemfile +2 -0
- data/Gemfile.lock +34 -18
- data/README.md +4 -0
- data/lib/roma/client/client_pool.rb +15 -25
- data/lib/roma/client/client_rttable.rb +1 -2
- data/lib/roma/client/tools/showbalance.rb +0 -1
- data/lib/roma/client/version.rb +1 -1
- data/spec/roma/client/client_pool_spec.rb +133 -173
- data/spec/spec_helper.rb +9 -0
- metadata +3 -79
- data/doc/CHANGELOG_md.html +0 -119
- data/doc/README_md.html +0 -161
- data/doc/Roma.html +0 -95
- data/doc/Roma/Client.html +0 -95
- data/doc/Roma/Client/ClientPool.html +0 -716
- data/doc/Roma/Client/ClientRoutingTable.html +0 -495
- data/doc/Roma/Client/ConPool.html +0 -484
- data/doc/Roma/Client/Plugin.html +0 -95
- data/doc/Roma/Client/Plugin/Alist.html +0 -1276
- data/doc/Roma/Client/Plugin/Map.html +0 -531
- data/doc/Roma/Client/Plugin/MapCount.html +0 -401
- data/doc/Roma/Client/Proxy.html +0 -95
- data/doc/Roma/Client/Proxy/ClientHandler.html +0 -273
- data/doc/Roma/Client/Proxy/Conpool.html +0 -394
- data/doc/Roma/Client/Proxy/Daemon.html +0 -305
- data/doc/Roma/Client/Proxy/RomaHandler.html +0 -217
- data/doc/Roma/Client/RomaClient.html +0 -1339
- data/doc/Roma/Client/Sender.html +0 -482
- data/doc/Roma/Client/Stats.html +0 -162
- data/doc/Roma/Client/VERSION.html +0 -141
- data/doc/Roma/Logging.html +0 -95
- data/doc/Roma/Logging/RLogger.html +0 -786
- data/doc/Roma/Logging/RLogger/ExtLogDev.html +0 -159
- data/doc/Roma/Logging/RLogger/ExtShiftAge.html +0 -95
- data/doc/Roma/Logging/RLogger/ExtTrace.html +0 -109
- data/doc/Roma/Logging/RLogger/Severity.html +0 -139
- data/doc/Roma/Routing.html +0 -95
- data/doc/Roma/Routing/RoutingData.html +0 -912
- data/doc/Roma/Routing/RoutingData/RandomNodeListMaker.html +0 -311
- data/doc/created.rid +0 -20
- data/doc/css/fonts.css +0 -167
- data/doc/css/rdoc.css +0 -590
- 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 +0 -210
- data/doc/js/darkfish.js +0 -161
- data/doc/js/jquery.js +0 -4
- data/doc/js/navigation.js +0 -142
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +0 -109
- data/doc/js/search_index.js +0 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +0 -228
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +0 -972
- data/lib/roma/client/routing/routing_data.rb +0 -241
data/doc/Roma/Routing.html
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset=" UTF-8">
|
6
|
-
|
7
|
-
<title>module Roma::Routing - 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
|
-
|
61
|
-
</div>
|
62
|
-
</nav>
|
63
|
-
|
64
|
-
<main role="main" aria-labelledby="module-Roma::Routing">
|
65
|
-
<h1 id="module-Roma::Routing" class="module">
|
66
|
-
module Roma::Routing
|
67
|
-
</h1>
|
68
|
-
|
69
|
-
<section class="description">
|
70
|
-
|
71
|
-
</section>
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
</section>
|
87
|
-
</main>
|
88
|
-
|
89
|
-
|
90
|
-
<footer id="validator-badges" role="contentinfo">
|
91
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
92
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
93
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
94
|
-
</footer>
|
95
|
-
|
@@ -1,912 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset=" UTF-8">
|
6
|
-
|
7
|
-
<title>class Roma::Routing::RoutingData - 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
|
-
|
66
|
-
|
67
|
-
<!-- Method Quickref -->
|
68
|
-
<div id="method-list-section" class="nav-section">
|
69
|
-
<h3>Methods</h3>
|
70
|
-
|
71
|
-
<ul class="link-list" role="directory">
|
72
|
-
|
73
|
-
<li ><a href="#method-c-create">::create</a>
|
74
|
-
|
75
|
-
<li ><a href="#method-c-load">::load</a>
|
76
|
-
|
77
|
-
<li ><a href="#method-c-load_snapshot">::load_snapshot</a>
|
78
|
-
|
79
|
-
<li ><a href="#method-c-new">::new</a>
|
80
|
-
|
81
|
-
<li ><a href="#method-c-snapshot">::snapshot</a>
|
82
|
-
|
83
|
-
<li ><a href="#method-i-create_nodes_from_v_idx">#create_nodes_from_v_idx</a>
|
84
|
-
|
85
|
-
<li ><a href="#method-i-each_log_all">#each_log_all</a>
|
86
|
-
|
87
|
-
<li ><a href="#method-i-each_log_one">#each_log_one</a>
|
88
|
-
|
89
|
-
<li ><a href="#method-i-get_file_list">#get_file_list</a>
|
90
|
-
|
91
|
-
<li ><a href="#method-i-get_histgram">#get_histgram</a>
|
92
|
-
|
93
|
-
<li ><a href="#method-i-get_lost_vnodes">#get_lost_vnodes</a>
|
94
|
-
|
95
|
-
<li ><a href="#method-i-load_log_all">#load_log_all</a>
|
96
|
-
|
97
|
-
<li ><a href="#method-i-load_log_one">#load_log_one</a>
|
98
|
-
|
99
|
-
<li ><a href="#method-i-next_vnode">#next_vnode</a>
|
100
|
-
|
101
|
-
<li ><a href="#method-i-parse_log">#parse_log</a>
|
102
|
-
|
103
|
-
<li ><a href="#method-i-save">#save</a>
|
104
|
-
|
105
|
-
<li ><a href="#method-i-search_mask">#search_mask</a>
|
106
|
-
|
107
|
-
</ul>
|
108
|
-
</div>
|
109
|
-
|
110
|
-
</div>
|
111
|
-
</nav>
|
112
|
-
|
113
|
-
<main role="main" aria-labelledby="class-Roma::Routing::RoutingData">
|
114
|
-
<h1 id="class-Roma::Routing::RoutingData" class="class">
|
115
|
-
class Roma::Routing::RoutingData
|
116
|
-
</h1>
|
117
|
-
|
118
|
-
<section class="description">
|
119
|
-
|
120
|
-
</section>
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
<section class="attribute-method-details" class="method-section">
|
134
|
-
<header>
|
135
|
-
<h3>Attributes</h3>
|
136
|
-
</header>
|
137
|
-
|
138
|
-
|
139
|
-
<div id="attribute-i-dgst_bits" class="method-detail">
|
140
|
-
<div class="method-heading attribute-method-heading">
|
141
|
-
<span class="method-name">dgst_bits</span><span
|
142
|
-
class="attribute-access-type">[RW]</span>
|
143
|
-
</div>
|
144
|
-
|
145
|
-
<div class="method-description">
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
</div>
|
150
|
-
</div>
|
151
|
-
|
152
|
-
<div id="attribute-i-div_bits" class="method-detail">
|
153
|
-
<div class="method-heading attribute-method-heading">
|
154
|
-
<span class="method-name">div_bits</span><span
|
155
|
-
class="attribute-access-type">[RW]</span>
|
156
|
-
</div>
|
157
|
-
|
158
|
-
<div class="method-description">
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
</div>
|
163
|
-
</div>
|
164
|
-
|
165
|
-
<div id="attribute-i-nodes" class="method-detail">
|
166
|
-
<div class="method-heading attribute-method-heading">
|
167
|
-
<span class="method-name">nodes</span><span
|
168
|
-
class="attribute-access-type">[RW]</span>
|
169
|
-
</div>
|
170
|
-
|
171
|
-
<div class="method-description">
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
</div>
|
176
|
-
</div>
|
177
|
-
|
178
|
-
<div id="attribute-i-rn" class="method-detail">
|
179
|
-
<div class="method-heading attribute-method-heading">
|
180
|
-
<span class="method-name">rn</span><span
|
181
|
-
class="attribute-access-type">[RW]</span>
|
182
|
-
</div>
|
183
|
-
|
184
|
-
<div class="method-description">
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
</div>
|
189
|
-
</div>
|
190
|
-
|
191
|
-
<div id="attribute-i-v_clk" class="method-detail">
|
192
|
-
<div class="method-heading attribute-method-heading">
|
193
|
-
<span class="method-name">v_clk</span><span
|
194
|
-
class="attribute-access-type">[RW]</span>
|
195
|
-
</div>
|
196
|
-
|
197
|
-
<div class="method-description">
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
</div>
|
202
|
-
</div>
|
203
|
-
|
204
|
-
<div id="attribute-i-v_idx" class="method-detail">
|
205
|
-
<div class="method-heading attribute-method-heading">
|
206
|
-
<span class="method-name">v_idx</span><span
|
207
|
-
class="attribute-access-type">[RW]</span>
|
208
|
-
</div>
|
209
|
-
|
210
|
-
<div class="method-description">
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
</div>
|
215
|
-
</div>
|
216
|
-
|
217
|
-
</section>
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
222
|
-
<header>
|
223
|
-
<h3>Public Class Methods</h3>
|
224
|
-
</header>
|
225
|
-
|
226
|
-
|
227
|
-
<div id="method-c-create" class="method-detail ">
|
228
|
-
|
229
|
-
<div class="method-heading">
|
230
|
-
<span class="method-name">create</span><span
|
231
|
-
class="method-args">(dgst_bits,div_bits,rn,nodes,repethost=false)</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="create-source">
|
246
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 140</span>
|
247
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">dgst_bits</span>,<span class="ruby-identifier">div_bits</span>,<span class="ruby-identifier">rn</span>,<span class="ruby-identifier">nodes</span>,<span class="ruby-identifier">repethost</span>=<span class="ruby-keyword">false</span>)
|
248
|
-
<span class="ruby-identifier">ret</span>=<span class="ruby-constant">RoutingData</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">dgst_bits</span>,<span class="ruby-identifier">div_bits</span>,<span class="ruby-identifier">rn</span>)
|
249
|
-
<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">nodes</span>=<span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">clone</span>
|
250
|
-
|
251
|
-
<span class="ruby-identifier">rnlm</span>=<span class="ruby-constant">RandomNodeListMaker</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">nodes</span>,<span class="ruby-identifier">repethost</span>)
|
252
|
-
|
253
|
-
(<span class="ruby-value">2</span><span class="ruby-operator">**</span><span class="ruby-identifier">div_bits</span>).<span class="ruby-identifier">times</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
254
|
-
<span class="ruby-identifier">vn</span>=<span class="ruby-identifier">i</span><span class="ruby-operator"><<</span>(<span class="ruby-identifier">dgst_bits</span><span class="ruby-operator">-</span><span class="ruby-identifier">div_bits</span>)
|
255
|
-
<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">v_clk</span>[<span class="ruby-identifier">vn</span>]=<span class="ruby-value">0</span>
|
256
|
-
<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">v_idx</span>[<span class="ruby-identifier">vn</span>]=<span class="ruby-identifier">rnlm</span>.<span class="ruby-identifier">list</span>(<span class="ruby-identifier">rn</span>)
|
257
|
-
}
|
258
|
-
<span class="ruby-identifier">ret</span>
|
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-c-load" class="method-detail ">
|
271
|
-
|
272
|
-
<div class="method-heading">
|
273
|
-
<span class="method-name">load</span><span
|
274
|
-
class="method-args">(fname)</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="load-source">
|
289
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 30</span>
|
290
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">fname</span>)
|
291
|
-
<span class="ruby-identifier">rd</span>=<span class="ruby-identifier">load_snapshot</span>(<span class="ruby-identifier">fname</span>)
|
292
|
-
<span class="ruby-identifier">rd</span>.<span class="ruby-identifier">load_log_all</span>(<span class="ruby-identifier">fname</span>)
|
293
|
-
<span class="ruby-identifier">rd</span>
|
294
|
-
<span class="ruby-keyword">end</span></pre>
|
295
|
-
</div>
|
296
|
-
|
297
|
-
</div>
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
</div>
|
303
|
-
|
304
|
-
|
305
|
-
<div id="method-c-load_snapshot" class="method-detail ">
|
306
|
-
|
307
|
-
<div class="method-heading">
|
308
|
-
<span class="method-name">load_snapshot</span><span
|
309
|
-
class="method-args">(fname)</span>
|
310
|
-
|
311
|
-
<span class="method-click-advice">click to toggle source</span>
|
312
|
-
|
313
|
-
</div>
|
314
|
-
|
315
|
-
|
316
|
-
<div class="method-description">
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
<div class="method-source-code" id="load_snapshot-source">
|
324
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 36</span>
|
325
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_snapshot</span>(<span class="ruby-identifier">fname</span>)
|
326
|
-
<span class="ruby-identifier">rd</span>=<span class="ruby-keyword">nil</span>
|
327
|
-
<span class="ruby-identifier">open</span>(<span class="ruby-identifier">fname</span>,<span class="ruby-string">'rb'</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
|
328
|
-
<span class="ruby-identifier">rd</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">io</span>.<span class="ruby-identifier">read</span>)
|
329
|
-
}
|
330
|
-
<span class="ruby-identifier">rd</span>
|
331
|
-
<span class="ruby-keyword">end</span></pre>
|
332
|
-
</div>
|
333
|
-
|
334
|
-
</div>
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
</div>
|
340
|
-
|
341
|
-
|
342
|
-
<div id="method-c-new" class="method-detail ">
|
343
|
-
|
344
|
-
<div class="method-heading">
|
345
|
-
<span class="method-name">new</span><span
|
346
|
-
class="method-args">(dgst_bits,div_bits,rn)</span>
|
347
|
-
|
348
|
-
<span class="method-click-advice">click to toggle source</span>
|
349
|
-
|
350
|
-
</div>
|
351
|
-
|
352
|
-
|
353
|
-
<div class="method-description">
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
<div class="method-source-code" id="new-source">
|
361
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 14</span>
|
362
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">dgst_bits</span>,<span class="ruby-identifier">div_bits</span>,<span class="ruby-identifier">rn</span>)
|
363
|
-
<span class="ruby-ivar">@dgst_bits</span>=<span class="ruby-identifier">dgst_bits</span>
|
364
|
-
<span class="ruby-ivar">@div_bits</span>=<span class="ruby-identifier">div_bits</span>
|
365
|
-
<span class="ruby-ivar">@rn</span>=<span class="ruby-identifier">rn</span>
|
366
|
-
<span class="ruby-ivar">@nodes</span>=[]
|
367
|
-
<span class="ruby-ivar">@v_idx</span>={}
|
368
|
-
<span class="ruby-ivar">@v_clk</span>={}
|
369
|
-
<span class="ruby-keyword">end</span></pre>
|
370
|
-
</div>
|
371
|
-
|
372
|
-
</div>
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
</div>
|
378
|
-
|
379
|
-
|
380
|
-
<div id="method-c-snapshot" class="method-detail ">
|
381
|
-
|
382
|
-
<div class="method-heading">
|
383
|
-
<span class="method-name">snapshot</span><span
|
384
|
-
class="method-args">(fname)</span>
|
385
|
-
|
386
|
-
<span class="method-click-advice">click to toggle source</span>
|
387
|
-
|
388
|
-
</div>
|
389
|
-
|
390
|
-
|
391
|
-
<div class="method-description">
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
<div class="method-source-code" id="snapshot-source">
|
399
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 44</span>
|
400
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">snapshot</span>(<span class="ruby-identifier">fname</span>)
|
401
|
-
<span class="ruby-identifier">rd</span>=<span class="ruby-identifier">load_snapshot</span>(<span class="ruby-identifier">fname</span>)
|
402
|
-
<span class="ruby-identifier">loglist</span>=<span class="ruby-identifier">rd</span>.<span class="ruby-identifier">get_file_list</span>(<span class="ruby-identifier">fname</span>)
|
403
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">loglist</span>.<span class="ruby-identifier">length</span><span class="ruby-operator"><</span><span class="ruby-value">2</span>
|
404
|
-
<span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
|
405
|
-
<span class="ruby-keyword">end</span>
|
406
|
-
<span class="ruby-identifier">loglist</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">loglist</span>.<span class="ruby-identifier">last</span>)
|
407
|
-
<span class="ruby-identifier">loglist</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span>,<span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
408
|
-
<span class="ruby-identifier">rd</span>.<span class="ruby-identifier">load_log_one</span>(<span class="ruby-identifier">f</span>)
|
409
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">rename</span>(<span class="ruby-identifier">f</span>,<span class="ruby-node">"#{f}~"</span>)
|
410
|
-
}
|
411
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">rename</span>(<span class="ruby-identifier">fname</span>,<span class="ruby-node">"#{fname}~"</span>)
|
412
|
-
<span class="ruby-identifier">rd</span>.<span class="ruby-identifier">save</span>(<span class="ruby-identifier">fname</span>)
|
413
|
-
<span class="ruby-keyword">true</span>
|
414
|
-
<span class="ruby-keyword">end</span></pre>
|
415
|
-
</div>
|
416
|
-
|
417
|
-
</div>
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
</div>
|
423
|
-
|
424
|
-
|
425
|
-
</section>
|
426
|
-
|
427
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
428
|
-
<header>
|
429
|
-
<h3>Public Instance Methods</h3>
|
430
|
-
</header>
|
431
|
-
|
432
|
-
|
433
|
-
<div id="method-i-create_nodes_from_v_idx" class="method-detail ">
|
434
|
-
|
435
|
-
<div class="method-heading">
|
436
|
-
<span class="method-name">create_nodes_from_v_idx</span><span
|
437
|
-
class="method-args">()</span>
|
438
|
-
|
439
|
-
<span class="method-click-advice">click to toggle source</span>
|
440
|
-
|
441
|
-
</div>
|
442
|
-
|
443
|
-
|
444
|
-
<div class="method-description">
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
<div class="method-source-code" id="create_nodes_from_v_idx-source">
|
452
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 123</span>
|
453
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_nodes_from_v_idx</span>
|
454
|
-
<span class="ruby-identifier">buf_nodes</span>={}
|
455
|
-
<span class="ruby-identifier">v_idx</span>.<span class="ruby-identifier">each_value</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">nids</span><span class="ruby-operator">|</span>
|
456
|
-
<span class="ruby-identifier">nids</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">nid</span><span class="ruby-operator">|</span> <span class="ruby-identifier">buf_nodes</span>[<span class="ruby-identifier">nid</span>]=<span class="ruby-identifier">nid</span> }
|
457
|
-
}
|
458
|
-
<span class="ruby-ivar">@nodes</span>=<span class="ruby-identifier">buf_nodes</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">sort</span>
|
459
|
-
<span class="ruby-keyword">end</span></pre>
|
460
|
-
</div>
|
461
|
-
|
462
|
-
</div>
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
</div>
|
468
|
-
|
469
|
-
|
470
|
-
<div id="method-i-each_log_all" class="method-detail ">
|
471
|
-
|
472
|
-
<div class="method-heading">
|
473
|
-
<span class="method-name">each_log_all</span><span
|
474
|
-
class="method-args">(fname) { |t,l| ... }</span>
|
475
|
-
|
476
|
-
<span class="method-click-advice">click to toggle source</span>
|
477
|
-
|
478
|
-
</div>
|
479
|
-
|
480
|
-
|
481
|
-
<div class="method-description">
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
<div class="method-source-code" id="each_log_all-source">
|
489
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 60</span>
|
490
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">each_log_all</span>(<span class="ruby-identifier">fname</span>)
|
491
|
-
<span class="ruby-identifier">loglist</span>=<span class="ruby-identifier">get_file_list</span>(<span class="ruby-identifier">fname</span>)
|
492
|
-
<span class="ruby-identifier">loglist</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span>,<span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
493
|
-
<span class="ruby-identifier">each_log_one</span>(<span class="ruby-identifier">f</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">t</span>,<span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-keyword">yield</span> <span class="ruby-identifier">t</span>,<span class="ruby-identifier">l</span>}
|
494
|
-
}
|
495
|
-
<span class="ruby-keyword">end</span></pre>
|
496
|
-
</div>
|
497
|
-
|
498
|
-
</div>
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
</div>
|
504
|
-
|
505
|
-
|
506
|
-
<div id="method-i-each_log_one" class="method-detail ">
|
507
|
-
|
508
|
-
<div class="method-heading">
|
509
|
-
<span class="method-name">each_log_one</span><span
|
510
|
-
class="method-args">(fname) { |mktime($1, $2, $3, $4, $5, $6), $7| ... }</span>
|
511
|
-
|
512
|
-
<span class="method-click-advice">click to toggle source</span>
|
513
|
-
|
514
|
-
</div>
|
515
|
-
|
516
|
-
|
517
|
-
<div class="method-description">
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
<div class="method-source-code" id="each_log_one-source">
|
525
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 67</span>
|
526
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">each_log_one</span>(<span class="ruby-identifier">fname</span>)
|
527
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">fname</span>,<span class="ruby-string">"r"</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
528
|
-
<span class="ruby-keyword">while</span>((<span class="ruby-identifier">line</span>=<span class="ruby-identifier">f</span>.<span class="ruby-identifier">gets</span>)<span class="ruby-operator">!=</span><span class="ruby-keyword">nil</span>)
|
529
|
-
<span class="ruby-identifier">line</span>.<span class="ruby-identifier">chomp!</span>
|
530
|
-
<span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">==</span><span class="ruby-node">"#"</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>
|
531
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.\d+\s(.+)/</span>
|
532
|
-
<span class="ruby-keyword">yield</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">mktime</span>(<span class="ruby-node">$1</span>, <span class="ruby-node">$2</span>, <span class="ruby-node">$3</span>, <span class="ruby-node">$4</span>, <span class="ruby-node">$5</span>, <span class="ruby-node">$6</span>), <span class="ruby-node">$7</span>
|
533
|
-
<span class="ruby-keyword">end</span>
|
534
|
-
<span class="ruby-keyword">end</span>
|
535
|
-
}
|
536
|
-
<span class="ruby-keyword">end</span></pre>
|
537
|
-
</div>
|
538
|
-
|
539
|
-
</div>
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
</div>
|
545
|
-
|
546
|
-
|
547
|
-
<div id="method-i-get_file_list" class="method-detail ">
|
548
|
-
|
549
|
-
<div class="method-heading">
|
550
|
-
<span class="method-name">get_file_list</span><span
|
551
|
-
class="method-args">(fname)</span>
|
552
|
-
|
553
|
-
<span class="method-click-advice">click to toggle source</span>
|
554
|
-
|
555
|
-
</div>
|
556
|
-
|
557
|
-
|
558
|
-
<div class="method-description">
|
559
|
-
|
560
|
-
<p>Returns the log file list by old ordered.</p>
|
561
|
-
<dl class="rdoc-list note-list"><dt><code>fname</code>
|
562
|
-
<dd>
|
563
|
-
<p>Prefix of a log file.(ex.roma0_3300.route)</p>
|
564
|
-
</dd></dl>
|
565
|
-
|
566
|
-
<p>One of the following example:</p>
|
567
|
-
|
568
|
-
<pre class="ruby">[[<span class="ruby-value">1</span>, <span class="ruby-string">"roma0_3300.route.1"</span>], [<span class="ruby-value">2</span>, <span class="ruby-string">"roma0_3300.route.2"</span>]]
|
569
|
-
</pre>
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
<div class="method-source-code" id="get_file_list-source">
|
575
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 158</span>
|
576
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_file_list</span>(<span class="ruby-identifier">fname</span>)
|
577
|
-
<span class="ruby-identifier">l</span>={}
|
578
|
-
<span class="ruby-identifier">files</span>=<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-node">"#{fname}*"</span>)
|
579
|
-
<span class="ruby-identifier">files</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
580
|
-
<span class="ruby-keyword">if</span> <span class="ruby-node">/#{fname}\.(\d+)$/</span><span class="ruby-operator">=~</span><span class="ruby-identifier">file</span>
|
581
|
-
<span class="ruby-identifier">l</span>[<span class="ruby-node">$1</span>.<span class="ruby-identifier">to_i</span>]=<span class="ruby-node">$&</span>
|
582
|
-
<span class="ruby-keyword">end</span>
|
583
|
-
}
|
584
|
-
<span class="ruby-comment"># sorted by old order</span>
|
585
|
-
<span class="ruby-identifier">l</span>.<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">sort</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>,<span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>[<span class="ruby-value">0</span>]<span class="ruby-operator"><=></span><span class="ruby-identifier">b</span>[<span class="ruby-value">0</span>]}
|
586
|
-
<span class="ruby-keyword">end</span></pre>
|
587
|
-
</div>
|
588
|
-
|
589
|
-
</div>
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
</div>
|
595
|
-
|
596
|
-
|
597
|
-
<div id="method-i-get_histgram" class="method-detail ">
|
598
|
-
|
599
|
-
<div class="method-heading">
|
600
|
-
<span class="method-name">get_histgram</span><span
|
601
|
-
class="method-args">()</span>
|
602
|
-
|
603
|
-
<span class="method-click-advice">click to toggle source</span>
|
604
|
-
|
605
|
-
</div>
|
606
|
-
|
607
|
-
|
608
|
-
<div class="method-description">
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
<div class="method-source-code" id="get_histgram-source">
|
616
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 170</span>
|
617
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_histgram</span>
|
618
|
-
<span class="ruby-identifier">ret</span> = {}
|
619
|
-
<span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">nid</span><span class="ruby-operator">|</span>
|
620
|
-
<span class="ruby-identifier">ret</span>[<span class="ruby-identifier">nid</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rn</span>,<span class="ruby-value">0</span>)
|
621
|
-
}
|
622
|
-
<span class="ruby-identifier">v_idx</span>.<span class="ruby-identifier">each_pair</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">vn</span>,<span class="ruby-identifier">nids</span><span class="ruby-operator">|</span>
|
623
|
-
<span class="ruby-identifier">nids</span>.<span class="ruby-identifier">each_with_index</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">nid</span>,<span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
624
|
-
<span class="ruby-identifier">ret</span>[<span class="ruby-identifier">nid</span>][<span class="ruby-identifier">i</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
625
|
-
}
|
626
|
-
}
|
627
|
-
<span class="ruby-identifier">ret</span>
|
628
|
-
<span class="ruby-keyword">end</span></pre>
|
629
|
-
</div>
|
630
|
-
|
631
|
-
</div>
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
</div>
|
637
|
-
|
638
|
-
|
639
|
-
<div id="method-i-get_lost_vnodes" class="method-detail ">
|
640
|
-
|
641
|
-
<div class="method-heading">
|
642
|
-
<span class="method-name">get_lost_vnodes</span><span
|
643
|
-
class="method-args">()</span>
|
644
|
-
|
645
|
-
<span class="method-click-advice">click to toggle source</span>
|
646
|
-
|
647
|
-
</div>
|
648
|
-
|
649
|
-
|
650
|
-
<div class="method-description">
|
651
|
-
|
652
|
-
<p>Returns the losted vnode-id list.</p>
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
<div class="method-source-code" id="get_lost_vnodes-source">
|
658
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 132</span>
|
659
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_lost_vnodes</span>
|
660
|
-
<span class="ruby-identifier">ret</span>=[]
|
661
|
-
<span class="ruby-identifier">v_idx</span>.<span class="ruby-identifier">each_pair</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">vn</span>,<span class="ruby-identifier">nids</span><span class="ruby-operator">|</span>
|
662
|
-
<span class="ruby-identifier">ret</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">vn</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">nids</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
663
|
-
}
|
664
|
-
<span class="ruby-identifier">ret</span>
|
665
|
-
<span class="ruby-keyword">end</span></pre>
|
666
|
-
</div>
|
667
|
-
|
668
|
-
</div>
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
</div>
|
674
|
-
|
675
|
-
|
676
|
-
<div id="method-i-load_log_all" class="method-detail ">
|
677
|
-
|
678
|
-
<div class="method-heading">
|
679
|
-
<span class="method-name">load_log_all</span><span
|
680
|
-
class="method-args">(fname)</span>
|
681
|
-
|
682
|
-
<span class="method-click-advice">click to toggle source</span>
|
683
|
-
|
684
|
-
</div>
|
685
|
-
|
686
|
-
|
687
|
-
<div class="method-description">
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
<div class="method-source-code" id="load_log_all-source">
|
695
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 79</span>
|
696
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">load_log_all</span>(<span class="ruby-identifier">fname</span>)
|
697
|
-
<span class="ruby-identifier">each_log_all</span>(<span class="ruby-identifier">fname</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">t</span>,<span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
698
|
-
<span class="ruby-identifier">parse_log</span>(<span class="ruby-identifier">t</span>,<span class="ruby-identifier">line</span>)
|
699
|
-
}
|
700
|
-
<span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">sort!</span>
|
701
|
-
<span class="ruby-keyword">end</span></pre>
|
702
|
-
</div>
|
703
|
-
|
704
|
-
</div>
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
</div>
|
710
|
-
|
711
|
-
|
712
|
-
<div id="method-i-load_log_one" class="method-detail ">
|
713
|
-
|
714
|
-
<div class="method-heading">
|
715
|
-
<span class="method-name">load_log_one</span><span
|
716
|
-
class="method-args">(fname)</span>
|
717
|
-
|
718
|
-
<span class="method-click-advice">click to toggle source</span>
|
719
|
-
|
720
|
-
</div>
|
721
|
-
|
722
|
-
|
723
|
-
<div class="method-description">
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
<div class="method-source-code" id="load_log_one-source">
|
731
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 86</span>
|
732
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">load_log_one</span>(<span class="ruby-identifier">fname</span>)
|
733
|
-
<span class="ruby-identifier">each_log_one</span>(<span class="ruby-identifier">fname</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">t</span>,<span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
734
|
-
<span class="ruby-identifier">parse_log</span>(<span class="ruby-identifier">t</span>,<span class="ruby-identifier">line</span>)
|
735
|
-
}
|
736
|
-
<span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">sort!</span>
|
737
|
-
<span class="ruby-keyword">end</span></pre>
|
738
|
-
</div>
|
739
|
-
|
740
|
-
</div>
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
</div>
|
746
|
-
|
747
|
-
|
748
|
-
<div id="method-i-next_vnode" class="method-detail ">
|
749
|
-
|
750
|
-
<div class="method-heading">
|
751
|
-
<span class="method-name">next_vnode</span><span
|
752
|
-
class="method-args">(vn)</span>
|
753
|
-
|
754
|
-
<span class="method-click-advice">click to toggle source</span>
|
755
|
-
|
756
|
-
</div>
|
757
|
-
|
758
|
-
|
759
|
-
<div class="method-description">
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
<div class="method-source-code" id="next_vnode-source">
|
767
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 117</span>
|
768
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">next_vnode</span>(<span class="ruby-identifier">vn</span>)
|
769
|
-
<span class="ruby-identifier">n</span> = (<span class="ruby-identifier">vn</span> <span class="ruby-operator">>></span> (<span class="ruby-ivar">@dgst_bits</span><span class="ruby-operator">-</span><span class="ruby-ivar">@div_bits</span>)) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
|
770
|
-
<span class="ruby-identifier">n</span> = <span class="ruby-value">0</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> (<span class="ruby-value">2</span><span class="ruby-operator">**</span><span class="ruby-ivar">@div_bits</span>)
|
771
|
-
<span class="ruby-identifier">n</span> <span class="ruby-operator"><<</span> (<span class="ruby-ivar">@dgst_bits</span><span class="ruby-operator">-</span><span class="ruby-ivar">@div_bits</span>)
|
772
|
-
<span class="ruby-keyword">end</span></pre>
|
773
|
-
</div>
|
774
|
-
|
775
|
-
</div>
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
</div>
|
781
|
-
|
782
|
-
|
783
|
-
<div id="method-i-parse_log" class="method-detail ">
|
784
|
-
|
785
|
-
<div class="method-heading">
|
786
|
-
<span class="method-name">parse_log</span><span
|
787
|
-
class="method-args">(t,line)</span>
|
788
|
-
|
789
|
-
<span class="method-click-advice">click to toggle source</span>
|
790
|
-
|
791
|
-
</div>
|
792
|
-
|
793
|
-
|
794
|
-
<div class="method-description">
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
<div class="method-source-code" id="parse_log-source">
|
802
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 93</span>
|
803
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">parse_log</span>(<span class="ruby-identifier">t</span>,<span class="ruby-identifier">line</span>)
|
804
|
-
<span class="ruby-identifier">s</span>=<span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">' '</span>)
|
805
|
-
<span class="ruby-keyword">case</span> <span class="ruby-identifier">s</span>[<span class="ruby-value">0</span>]
|
806
|
-
<span class="ruby-keyword">when</span> <span class="ruby-string">'setroute'</span>
|
807
|
-
<span class="ruby-comment"># setroute <vnode-id> <clock> <node-id> ...</span>
|
808
|
-
<span class="ruby-identifier">nids</span>=[]
|
809
|
-
<span class="ruby-identifier">s</span>[<span class="ruby-value">3</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">nid</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nids</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">nid</span> }
|
810
|
-
<span class="ruby-ivar">@v_idx</span>[<span class="ruby-identifier">s</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_i</span>]=<span class="ruby-identifier">nids</span>
|
811
|
-
<span class="ruby-ivar">@v_clk</span>[<span class="ruby-identifier">s</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_i</span>]=<span class="ruby-identifier">s</span>[<span class="ruby-value">2</span>].<span class="ruby-identifier">to_i</span>
|
812
|
-
<span class="ruby-keyword">when</span> <span class="ruby-string">'join'</span>
|
813
|
-
<span class="ruby-comment"># join <node-id></span>
|
814
|
-
<span class="ruby-ivar">@nodes</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">s</span>[<span class="ruby-value">1</span>] <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">s</span>[<span class="ruby-value">1</span>])
|
815
|
-
<span class="ruby-keyword">when</span> <span class="ruby-string">'leave'</span>
|
816
|
-
<span class="ruby-comment"># leave <node-id></span>
|
817
|
-
<span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">s</span>[<span class="ruby-value">1</span>])
|
818
|
-
<span class="ruby-keyword">else</span>
|
819
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"RoutingData.parse_log:parse error #{line}"</span>
|
820
|
-
<span class="ruby-keyword">end</span>
|
821
|
-
<span class="ruby-keyword">end</span></pre>
|
822
|
-
</div>
|
823
|
-
|
824
|
-
</div>
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
</div>
|
830
|
-
|
831
|
-
|
832
|
-
<div id="method-i-save" class="method-detail ">
|
833
|
-
|
834
|
-
<div class="method-heading">
|
835
|
-
<span class="method-name">save</span><span
|
836
|
-
class="method-args">(fname)</span>
|
837
|
-
|
838
|
-
<span class="method-click-advice">click to toggle source</span>
|
839
|
-
|
840
|
-
</div>
|
841
|
-
|
842
|
-
|
843
|
-
<div class="method-description">
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
<div class="method-source-code" id="save-source">
|
851
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 23</span>
|
852
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">save</span>(<span class="ruby-identifier">fname</span>)
|
853
|
-
<span class="ruby-ivar">@nodes</span>.<span class="ruby-identifier">sort!</span>
|
854
|
-
<span class="ruby-identifier">open</span>(<span class="ruby-identifier">fname</span>,<span class="ruby-string">'wb'</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
|
855
|
-
<span class="ruby-identifier">io</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">YAML</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-keyword">self</span>))
|
856
|
-
}
|
857
|
-
<span class="ruby-keyword">end</span></pre>
|
858
|
-
</div>
|
859
|
-
|
860
|
-
</div>
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
</div>
|
866
|
-
|
867
|
-
|
868
|
-
<div id="method-i-search_mask" class="method-detail ">
|
869
|
-
|
870
|
-
<div class="method-heading">
|
871
|
-
<span class="method-name">search_mask</span><span
|
872
|
-
class="method-args">()</span>
|
873
|
-
|
874
|
-
<span class="method-click-advice">click to toggle source</span>
|
875
|
-
|
876
|
-
</div>
|
877
|
-
|
878
|
-
|
879
|
-
<div class="method-description">
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
<div class="method-source-code" id="search_mask-source">
|
887
|
-
<pre><span class="ruby-comment"># File lib/roma/client/routing/routing_data.rb, line 113</span>
|
888
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">search_mask</span>
|
889
|
-
<span class="ruby-value">2</span><span class="ruby-operator">**</span><span class="ruby-ivar">@div_bits</span><span class="ruby-operator">-</span><span class="ruby-value">1</span><span class="ruby-operator"><<</span>(<span class="ruby-ivar">@dgst_bits</span><span class="ruby-operator">-</span><span class="ruby-ivar">@div_bits</span>)
|
890
|
-
<span class="ruby-keyword">end</span></pre>
|
891
|
-
</div>
|
892
|
-
|
893
|
-
</div>
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
</div>
|
899
|
-
|
900
|
-
|
901
|
-
</section>
|
902
|
-
|
903
|
-
</section>
|
904
|
-
</main>
|
905
|
-
|
906
|
-
|
907
|
-
<footer id="validator-badges" role="contentinfo">
|
908
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
909
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
910
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
911
|
-
</footer>
|
912
|
-
|