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.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/{CHANGELOG → CHANGELOG.md} +8 -5
  3. data/Gemfile.lock +23 -15
  4. data/README.md +62 -0
  5. data/Rakefile +3 -3
  6. data/doc/CHANGELOG_md.html +119 -0
  7. data/doc/README_md.html +161 -0
  8. data/doc/Roma/Client/ClientPool.html +716 -0
  9. data/doc/Roma/Client/ClientRoutingTable.html +495 -0
  10. data/doc/Roma/Client/ConPool.html +484 -0
  11. data/doc/Roma/Client/Plugin/Alist.html +1276 -0
  12. data/doc/Roma/Client/Plugin/Map.html +531 -0
  13. data/doc/Roma/Client/Plugin/MapCount.html +401 -0
  14. data/doc/Roma/Client/Plugin.html +95 -0
  15. data/doc/Roma/Client/Proxy/ClientHandler.html +273 -0
  16. data/doc/Roma/Client/Proxy/Conpool.html +394 -0
  17. data/doc/Roma/Client/Proxy/Daemon.html +305 -0
  18. data/doc/Roma/Client/Proxy/RomaHandler.html +217 -0
  19. data/doc/Roma/Client/Proxy.html +95 -0
  20. data/doc/Roma/Client/RomaClient.html +1339 -0
  21. data/doc/Roma/Client/Sender.html +482 -0
  22. data/doc/Roma/Client/Stats.html +162 -0
  23. data/doc/Roma/Client/VERSION.html +141 -0
  24. data/doc/Roma/Client.html +95 -0
  25. data/doc/Roma/Logging/RLogger/ExtLogDev.html +159 -0
  26. data/doc/Roma/Logging/RLogger/ExtShiftAge.html +95 -0
  27. data/doc/Roma/Logging/RLogger/ExtTrace.html +109 -0
  28. data/doc/Roma/Logging/RLogger/Severity.html +139 -0
  29. data/doc/Roma/Logging/RLogger.html +786 -0
  30. data/doc/Roma/Logging.html +95 -0
  31. data/doc/Roma/Routing/RoutingData/RandomNodeListMaker.html +311 -0
  32. data/doc/Roma/Routing/RoutingData.html +912 -0
  33. data/doc/Roma/Routing.html +95 -0
  34. data/doc/Roma.html +95 -0
  35. data/doc/created.rid +20 -0
  36. data/doc/css/fonts.css +167 -0
  37. data/doc/css/rdoc.css +590 -0
  38. data/doc/fonts/Lato-Light.ttf +0 -0
  39. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  40. data/doc/fonts/Lato-Regular.ttf +0 -0
  41. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  42. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  43. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  44. data/doc/images/add.png +0 -0
  45. data/doc/images/arrow_up.png +0 -0
  46. data/doc/images/brick.png +0 -0
  47. data/doc/images/brick_link.png +0 -0
  48. data/doc/images/bug.png +0 -0
  49. data/doc/images/bullet_black.png +0 -0
  50. data/doc/images/bullet_toggle_minus.png +0 -0
  51. data/doc/images/bullet_toggle_plus.png +0 -0
  52. data/doc/images/date.png +0 -0
  53. data/doc/images/delete.png +0 -0
  54. data/doc/images/find.png +0 -0
  55. data/doc/images/loadingAnimation.gif +0 -0
  56. data/doc/images/macFFBgHack.png +0 -0
  57. data/doc/images/package.png +0 -0
  58. data/doc/images/page_green.png +0 -0
  59. data/doc/images/page_white_text.png +0 -0
  60. data/doc/images/page_white_width.png +0 -0
  61. data/doc/images/plugin.png +0 -0
  62. data/doc/images/ruby.png +0 -0
  63. data/doc/images/tag_blue.png +0 -0
  64. data/doc/images/tag_green.png +0 -0
  65. data/doc/images/transparent.png +0 -0
  66. data/doc/images/wrench.png +0 -0
  67. data/doc/images/wrench_orange.png +0 -0
  68. data/doc/images/zoom.png +0 -0
  69. data/doc/index.html +210 -0
  70. data/doc/js/darkfish.js +161 -0
  71. data/doc/js/jquery.js +4 -0
  72. data/doc/js/navigation.js +142 -0
  73. data/doc/js/navigation.js.gz +0 -0
  74. data/doc/js/search.js +109 -0
  75. data/doc/js/search_index.js +1 -0
  76. data/doc/js/search_index.js.gz +0 -0
  77. data/doc/js/searcher.js +228 -0
  78. data/doc/js/searcher.js.gz +0 -0
  79. data/doc/table_of_contents.html +972 -0
  80. data/lib/roma/client/rclient.rb +2 -1
  81. data/lib/roma/client/sender.rb +2 -2
  82. data/lib/roma/client/version.rb +1 -1
  83. data/lib/roma/client.rb +0 -21
  84. metadata +84 -10
  85. data/README +0 -17
@@ -0,0 +1,1339 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset=" UTF-8">
6
+
7
+ <title>class Roma::Client::RomaClient - 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-new">::new</a>
74
+
75
+ <li ><a href="#method-i-5B-5D">#[]</a>
76
+
77
+ <li ><a href="#method-i-5B-5D-3D">#[]=</a>
78
+
79
+ <li ><a href="#method-i-add">#add</a>
80
+
81
+ <li ><a href="#method-i-append">#append</a>
82
+
83
+ <li ><a href="#method-i-cas">#cas</a>
84
+
85
+ <li ><a href="#method-i-decr">#decr</a>
86
+
87
+ <li ><a href="#method-i-delete">#delete</a>
88
+
89
+ <li ><a href="#method-i-flush_all">#flush_all</a>
90
+
91
+ <li ><a href="#method-i-get">#get</a>
92
+
93
+ <li ><a href="#method-i-gets">#gets</a>
94
+
95
+ <li ><a href="#method-i-incr">#incr</a>
96
+
97
+ <li ><a href="#method-i-make_rttable">#make_rttable</a>
98
+
99
+ <li ><a href="#method-i-out">#out</a>
100
+
101
+ <li ><a href="#method-i-prepend">#prepend</a>
102
+
103
+ <li ><a href="#method-i-replace">#replace</a>
104
+
105
+ <li ><a href="#method-i-rttable_last_update">#rttable_last_update</a>
106
+
107
+ <li ><a href="#method-i-set">#set</a>
108
+
109
+ <li ><a href="#method-i-stats">#stats</a>
110
+
111
+ <li ><a href="#method-i-update_rttable">#update_rttable</a>
112
+
113
+ <li ><a href="#method-i-verbosity">#verbosity</a>
114
+
115
+ <li ><a href="#method-i-version">#version</a>
116
+
117
+ </ul>
118
+ </div>
119
+
120
+ </div>
121
+ </nav>
122
+
123
+ <main role="main" aria-labelledby="class-Roma::Client::RomaClient">
124
+ <h1 id="class-Roma::Client::RomaClient" class="class">
125
+ class Roma::Client::RomaClient
126
+ </h1>
127
+
128
+ <section class="description">
129
+
130
+ <p>Class to access ROMA .</p>
131
+
132
+ </section>
133
+
134
+
135
+
136
+
137
+ <section id="5Buntitled-5D" class="documentation-section">
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+ <section class="attribute-method-details" class="method-section">
146
+ <header>
147
+ <h3>Attributes</h3>
148
+ </header>
149
+
150
+
151
+ <div id="attribute-i-default_hash_name" class="method-detail">
152
+ <div class="method-heading attribute-method-heading">
153
+ <span class="method-name">default_hash_name</span><span
154
+ class="attribute-access-type">[RW]</span>
155
+ </div>
156
+
157
+ <div class="method-description">
158
+
159
+
160
+
161
+ </div>
162
+ </div>
163
+
164
+ <div id="attribute-i-retry_count_read" class="method-detail">
165
+ <div class="method-heading attribute-method-heading">
166
+ <span class="method-name">retry_count_read</span><span
167
+ class="attribute-access-type">[RW]</span>
168
+ </div>
169
+
170
+ <div class="method-description">
171
+
172
+
173
+
174
+ </div>
175
+ </div>
176
+
177
+ <div id="attribute-i-retry_count_write" class="method-detail">
178
+ <div class="method-heading attribute-method-heading">
179
+ <span class="method-name">retry_count_write</span><span
180
+ class="attribute-access-type">[RW]</span>
181
+ </div>
182
+
183
+ <div class="method-description">
184
+
185
+
186
+
187
+ </div>
188
+ </div>
189
+
190
+ <div id="attribute-i-rttable" class="method-detail">
191
+ <div class="method-heading attribute-method-heading">
192
+ <span class="method-name">rttable</span><span
193
+ class="attribute-access-type">[RW]</span>
194
+ </div>
195
+
196
+ <div class="method-description">
197
+
198
+
199
+
200
+ </div>
201
+ </div>
202
+
203
+ <div id="attribute-i-sender" class="method-detail">
204
+ <div class="method-heading attribute-method-heading">
205
+ <span class="method-name">sender</span><span
206
+ class="attribute-access-type">[RW]</span>
207
+ </div>
208
+
209
+ <div class="method-description">
210
+
211
+
212
+
213
+ </div>
214
+ </div>
215
+
216
+ </section>
217
+
218
+
219
+
220
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
221
+ <header>
222
+ <h3>Public Class Methods</h3>
223
+ </header>
224
+
225
+
226
+ <div id="method-c-new" class="method-detail ">
227
+
228
+ <div class="method-heading">
229
+ <span class="method-name">new</span><span
230
+ class="method-args">(ini_nodes, plugin_modules = nil, start_sync_routing_proc = true)</span>
231
+
232
+ <span class="method-click-advice">click to toggle source</span>
233
+
234
+ </div>
235
+
236
+
237
+ <div class="method-description">
238
+
239
+ <p>ROMA client constractor .</p>
240
+ <dl class="rdoc-list label-list"><dt>ini_nodes
241
+ <dd>
242
+ <p>ROMA nodes array</p>
243
+ </dd><dt>plugin_modules
244
+ <dd>
245
+ <p>set plugin modules if you use .</p>
246
+ </dd></dl>
247
+
248
+
249
+
250
+
251
+ <div class="method-source-code" id="new-source">
252
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 26</span>
253
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">ini_nodes</span>, <span class="ruby-identifier">plugin_modules</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">start_sync_routing_proc</span> = <span class="ruby-keyword">true</span>)
254
+ <span class="ruby-ivar">@retry_count_write</span> = <span class="ruby-value">10</span>
255
+ <span class="ruby-ivar">@retry_count_read</span> = <span class="ruby-value">5</span>
256
+ <span class="ruby-ivar">@default_hash_name</span> = <span class="ruby-string">&#39;roma&#39;</span>
257
+
258
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">plugin_modules</span>
259
+ <span class="ruby-identifier">plugin_modules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">plugin</span><span class="ruby-operator">|</span>
260
+ <span class="ruby-keyword">self</span>.<span class="ruby-identifier">extend</span> <span class="ruby-identifier">plugin</span>
261
+ <span class="ruby-keyword">end</span>
262
+ <span class="ruby-keyword">end</span>
263
+
264
+ <span class="ruby-identifier">init_sender</span>
265
+ <span class="ruby-identifier">update_rttable</span>(<span class="ruby-identifier">ini_nodes</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-string">&#39;:&#39;</span>, <span class="ruby-string">&#39;_&#39;</span>) })
266
+ <span class="ruby-identifier">init_sync_routing_proc</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">start_sync_routing_proc</span>
267
+ <span class="ruby-keyword">end</span></pre>
268
+ </div>
269
+
270
+ </div>
271
+
272
+
273
+
274
+
275
+ </div>
276
+
277
+
278
+ </section>
279
+
280
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
281
+ <header>
282
+ <h3>Public Instance Methods</h3>
283
+ </header>
284
+
285
+
286
+ <div id="method-i-5B-5D" class="method-detail ">
287
+
288
+ <div class="method-heading">
289
+ <span class="method-name">[]</span><span
290
+ class="method-args">(key)</span>
291
+
292
+ <span class="method-click-advice">click to toggle source</span>
293
+
294
+ </div>
295
+
296
+
297
+ <div class="method-description">
298
+
299
+ <p>Get value from ROMA .</p>
300
+ <dl class="rdoc-list label-list"><dt>key
301
+ <dd>
302
+ <p>key for roma.</p>
303
+ </dd></dl>
304
+
305
+ <p><code>returen</code></p>
306
+
307
+ <pre>value sotored roma .
308
+ If key don&#39;t exit ROMA, return nil .
309
+ If coneect error, throw Exception .</pre>
310
+
311
+
312
+
313
+
314
+ <div class="method-source-code" id="5B-5D-source">
315
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 111</span>
316
+ <span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
317
+ <span class="ruby-identifier">get</span>(<span class="ruby-identifier">key</span>)
318
+ <span class="ruby-keyword">end</span></pre>
319
+ </div>
320
+
321
+ </div>
322
+
323
+
324
+
325
+
326
+ </div>
327
+
328
+
329
+ <div id="method-i-5B-5D-3D" class="method-detail ">
330
+
331
+ <div class="method-heading">
332
+ <span class="method-name">[]=</span><span
333
+ class="method-args">(key, value)</span>
334
+
335
+ <span class="method-click-advice">click to toggle source</span>
336
+
337
+ </div>
338
+
339
+
340
+ <div class="method-description">
341
+
342
+ <p>Set value to ROMA . please see set method .</p>
343
+
344
+
345
+
346
+
347
+ <div class="method-source-code" id="5B-5D-3D-source">
348
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 101</span>
349
+ <span class="ruby-keyword">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
350
+ <span class="ruby-identifier">set</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
351
+ <span class="ruby-keyword">end</span></pre>
352
+ </div>
353
+
354
+ </div>
355
+
356
+
357
+
358
+
359
+ </div>
360
+
361
+
362
+ <div id="method-i-add" class="method-detail ">
363
+
364
+ <div class="method-heading">
365
+ <span class="method-name">add</span><span
366
+ class="method-args">(key, val, expt = 0, raw = false)</span>
367
+
368
+ <span class="method-click-advice">click to toggle source</span>
369
+
370
+ </div>
371
+
372
+
373
+ <div class="method-description">
374
+
375
+ <p>Add value to ROMA .</p>
376
+
377
+ <p>If same key exists in ROMA, this method don&#39;t overwrite value and
378
+ return NOT_STORED .</p>
379
+ <dl class="rdoc-list label-list"><dt>key
380
+ <dd>
381
+ <p>key for store .</p>
382
+ </dd><dt>value
383
+ <dd>
384
+ <p>store value .</p>
385
+ </dd><dt>exp
386
+ <dd>
387
+ <p>expire seconds .</p>
388
+ </dd><dt>raw
389
+ <dd>
390
+ <p>You set this value true, value isn&#39;t marshaled .</p>
391
+ </dd><dt>return
392
+ <dd>
393
+ <p>return follow set status .</p>
394
+ </dd></dl>
395
+ <ul><li>
396
+ <p>If method is success, return STORED .</p>
397
+ </li><li>
398
+ <p>If same key exists in ROMA, return NOT_STORED .</p>
399
+ </li><li>
400
+ <p>If server error, return SERVER_ERROR .</p>
401
+ </li></ul>
402
+
403
+ <p>If socket error occured, throw Exception .</p>
404
+
405
+ <p>If socket timeout occured, throw TimeoutError .</p>
406
+
407
+
408
+
409
+
410
+ <div class="method-source-code" id="add-source">
411
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 155</span>
412
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">expt</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">raw</span> = <span class="ruby-keyword">false</span>)
413
+ <span class="ruby-identifier">val</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">val</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">raw</span>
414
+ <span class="ruby-identifier">sender</span>(<span class="ruby-value">:oneline_receiver</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-string">&quot;add %s 0 %d %d&quot;</span>, <span class="ruby-identifier">expt</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">val</span>.<span class="ruby-identifier">length</span>)
415
+ <span class="ruby-keyword">end</span></pre>
416
+ </div>
417
+
418
+ </div>
419
+
420
+
421
+
422
+
423
+ </div>
424
+
425
+
426
+ <div id="method-i-append" class="method-detail ">
427
+
428
+ <div class="method-heading">
429
+ <span class="method-name">append</span><span
430
+ class="method-args">(key, val, expt = 0)</span>
431
+
432
+ <span class="method-click-advice">click to toggle source</span>
433
+
434
+ </div>
435
+
436
+
437
+ <div class="method-description">
438
+
439
+ <p>Append value to exists string .</p>
440
+
441
+ <p>If same key exists in ROMA, this method append value . If same key
442
+ doesn&#39;t exist in ROMA this method don&#39;t store value and return
443
+ NOT_STORE .</p>
444
+ <dl class="rdoc-list label-list"><dt>key
445
+ <dd>
446
+ <p>key for append .</p>
447
+ </dd><dt>value
448
+ <dd>
449
+ <p>append value .</p>
450
+ </dd><dt>exp
451
+ <dd>
452
+ <p>expire seconds .</p>
453
+ </dd><dt>return
454
+ <dd>
455
+ <p>return follow set status .</p>
456
+ </dd></dl>
457
+ <ul><li>
458
+ <p>If method is success, return STORED .</p>
459
+ </li><li>
460
+ <p>If same key exists in ROMA, return NOT_STORED .</p>
461
+ </li><li>
462
+ <p>If server error, return SERVER_ERROR .</p>
463
+ </li></ul>
464
+
465
+ <p>If socket error occured, throw Exception .</p>
466
+
467
+ <p>If socket timeout occured, throw TimeoutError .</p>
468
+
469
+
470
+
471
+
472
+ <div class="method-source-code" id="append-source">
473
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 202</span>
474
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">append</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">expt</span> = <span class="ruby-value">0</span>)
475
+ <span class="ruby-identifier">sender</span>(<span class="ruby-value">:oneline_receiver</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-string">&quot;append %s 0 %d %d&quot;</span>, <span class="ruby-identifier">expt</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">val</span>.<span class="ruby-identifier">length</span>)
476
+ <span class="ruby-keyword">end</span></pre>
477
+ </div>
478
+
479
+ </div>
480
+
481
+
482
+
483
+
484
+ </div>
485
+
486
+
487
+ <div id="method-i-cas" class="method-detail ">
488
+
489
+ <div class="method-heading">
490
+ <span class="method-name">cas</span><span
491
+ class="method-args">(key, expt = 0, raw = false) { |val| ... }</span>
492
+
493
+ <span class="method-click-advice">click to toggle source</span>
494
+
495
+ </div>
496
+
497
+
498
+ <div class="method-description">
499
+
500
+ <p>Compare And Swap value .</p>
501
+ <dl class="rdoc-list label-list"><dt>key
502
+ <dd>
503
+ <p>key for cas .</p>
504
+ </dd><dt>value
505
+ <dd>
506
+ <p>store value .</p>
507
+ </dd><dt>exp
508
+ <dd>
509
+ <p>expire seconds .</p>
510
+ </dd><dt>return
511
+ <dd>
512
+ <p>return follow set status .</p>
513
+ </dd></dl>
514
+ <ul><li>
515
+ <p>If method is success, return STORED .</p>
516
+ </li><li>
517
+ <p>If method cannot update value, return EXISTS .</p>
518
+ </li><li>
519
+ <p>If key doesn&#39;t exist in ROMA, this method return NOT_FOUND.</p>
520
+ </li><li>
521
+ <p>If server error, return SERVER_ERROR .</p>
522
+ </li></ul>
523
+
524
+ <p>If socket error occured, throw Exception .</p>
525
+
526
+ <p>If socket timeout occured, throw TimeoutError .</p>
527
+
528
+
529
+
530
+
531
+ <div class="method-source-code" id="cas-source">
532
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 243</span>
533
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">cas</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">expt</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">raw</span> = <span class="ruby-keyword">false</span>)
534
+ <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;A block is required&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>
535
+
536
+ (<span class="ruby-identifier">val</span>, <span class="ruby-identifier">casid</span>) = <span class="ruby-identifier">gets_with_casid</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">raw</span>)
537
+ <span class="ruby-keyword">return</span> <span class="ruby-string">&quot;NOT_FOUND&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">val</span>
538
+ <span class="ruby-identifier">updated</span> = <span class="ruby-keyword">yield</span> <span class="ruby-identifier">val</span>
539
+ <span class="ruby-identifier">val</span> = <span class="ruby-identifier">raw</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">updated</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">updated</span>)
540
+
541
+ <span class="ruby-identifier">sender</span>(<span class="ruby-value">:oneline_receiver</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-string">&quot;cas %s 0 %d %d %s&quot;</span>, <span class="ruby-identifier">expt</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">val</span>.<span class="ruby-identifier">length</span>, <span class="ruby-identifier">casid</span>)
542
+ <span class="ruby-keyword">end</span></pre>
543
+ </div>
544
+
545
+ </div>
546
+
547
+
548
+
549
+
550
+ </div>
551
+
552
+
553
+ <div id="method-i-decr" class="method-detail ">
554
+
555
+ <div class="method-heading">
556
+ <span class="method-name">decr</span><span
557
+ class="method-args">(key, val = 1)</span>
558
+
559
+ <span class="method-click-advice">click to toggle source</span>
560
+
561
+ </div>
562
+
563
+
564
+ <div class="method-description">
565
+
566
+ <p>decrement value .</p>
567
+ <dl class="rdoc-list label-list"><dt>key
568
+ <dd>
569
+ <p>key for decremental .</p>
570
+ </dd><dt>val
571
+ <dd>
572
+ <p>decremental value .</p>
573
+ </dd><dt>return
574
+ <dd>
575
+ <p>Fixnum decrementaled value .</p>
576
+ </dd></dl>
577
+
578
+ <p>If same key doesn&#39;t exist in ROMA, return NOT_FOUND .</p>
579
+
580
+ <p>If socket error occured, throw Exception .</p>
581
+
582
+ <p>If socket timeout occured, throw TimeoutError .</p>
583
+
584
+
585
+
586
+
587
+ <div class="method-source-code" id="decr-source">
588
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 373</span>
589
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">decr</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span> = <span class="ruby-value">1</span>)
590
+ <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">sender</span>(<span class="ruby-value">:oneline_receiver</span>, <span class="ruby-identifier">key</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-string">&quot;decr %s %d&quot;</span>, <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_i</span>)
591
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">ret</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\D/</span>
592
+ <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">to_i</span>
593
+ <span class="ruby-keyword">end</span></pre>
594
+ </div>
595
+
596
+ </div>
597
+
598
+
599
+
600
+
601
+ </div>
602
+
603
+
604
+ <div id="method-i-delete" class="method-detail ">
605
+
606
+ <div class="method-heading">
607
+ <span class="method-name">delete</span><span
608
+ class="method-args">(key)</span>
609
+
610
+ <span class="method-click-advice">click to toggle source</span>
611
+
612
+ </div>
613
+
614
+
615
+ <div class="method-description">
616
+
617
+ <p>Delete value .</p>
618
+ <dl class="rdoc-list label-list"><dt>key
619
+ <dd>
620
+ <p>key for delete .</p>
621
+ </dd><dt>return
622
+ <dd>
623
+ <p>return follow set status .</p>
624
+ </dd></dl>
625
+ <ul><li>
626
+ <p>If method is success, return DELETED .</p>
627
+ </li><li>
628
+ <p>If same key doesn&#39;t exist in ROMA, return NOT_FOUND .</p>
629
+ </li><li>
630
+ <p>If server error, return SERVER_ERROR .</p>
631
+ </li></ul>
632
+
633
+ <p>If socket error occured, throw Exception .</p>
634
+
635
+ <p>If socket timeout occured, throw TimeoutError .</p>
636
+
637
+
638
+
639
+
640
+ <div class="method-source-code" id="delete-source">
641
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 266</span>
642
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
643
+ <span class="ruby-identifier">sender</span>(<span class="ruby-value">:oneline_receiver</span>, <span class="ruby-identifier">key</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-string">&quot;delete %s&quot;</span>)
644
+ <span class="ruby-keyword">end</span></pre>
645
+ </div>
646
+
647
+ </div>
648
+
649
+
650
+
651
+
652
+ </div>
653
+
654
+
655
+ <div id="method-i-flush_all" class="method-detail ">
656
+
657
+ <div class="method-heading">
658
+ <span class="method-name">flush_all</span><span
659
+ class="method-args">()</span>
660
+
661
+ <span class="method-click-advice">click to toggle source</span>
662
+
663
+ </div>
664
+
665
+
666
+ <div class="method-description">
667
+
668
+
669
+
670
+
671
+
672
+
673
+ <div class="method-source-code" id="flush_all-source">
674
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 340</span>
675
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">flush_all</span>()
676
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;Unsupported yet&quot;</span>) <span class="ruby-comment"># TODO</span>
677
+ <span class="ruby-ivar">@sender</span>.<span class="ruby-identifier">send_flush_all_command</span>
678
+ <span class="ruby-keyword">end</span></pre>
679
+ </div>
680
+
681
+ </div>
682
+
683
+
684
+
685
+
686
+ </div>
687
+
688
+
689
+ <div id="method-i-get" class="method-detail ">
690
+
691
+ <div class="method-heading">
692
+ <span class="method-name">get</span><span
693
+ class="method-args">(key, raw = false)</span>
694
+
695
+ <span class="method-click-advice">click to toggle source</span>
696
+
697
+ </div>
698
+
699
+
700
+ <div class="method-description">
701
+
702
+ <p>get value</p>
703
+ <dl class="rdoc-list label-list"><dt>key
704
+ <dd>
705
+ <p>key for get .</p>
706
+ </dd><dt>raw
707
+ <dd>
708
+ <p>If you set this value true, value isn&#39;t Marshal.load value .</p>
709
+ </dd><dt>return
710
+ <dd>
711
+ <p>return stored value in ROMA .</p>
712
+ </dd></dl>
713
+
714
+ <p>If key doesn&#39;t exist in ROMA, this method return nil .</p>
715
+
716
+ <p>If socket error occured, throw Exception .</p>
717
+
718
+ <p>If socket timeout occured, throw TimeoutError .</p>
719
+
720
+
721
+
722
+
723
+ <div class="method-source-code" id="get-source">
724
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 301</span>
725
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">raw</span> = <span class="ruby-keyword">false</span>)
726
+ <span class="ruby-identifier">val</span> = <span class="ruby-identifier">sender</span>(<span class="ruby-value">:value_list_receiver</span>, <span class="ruby-identifier">key</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-string">&quot;get %s&quot;</span>)[<span class="ruby-value">0</span>]
727
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">nil?</span>
728
+ <span class="ruby-identifier">val</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">val</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">raw</span>
729
+ <span class="ruby-identifier">val</span>
730
+ <span class="ruby-keyword">end</span></pre>
731
+ </div>
732
+
733
+ </div>
734
+
735
+
736
+
737
+
738
+ </div>
739
+
740
+
741
+ <div id="method-i-gets" class="method-detail ">
742
+
743
+ <div class="method-heading">
744
+ <span class="method-name">gets</span><span
745
+ class="method-args">(keys, raw = false)</span>
746
+
747
+ <span class="method-click-advice">click to toggle source</span>
748
+
749
+ </div>
750
+
751
+
752
+ <div class="method-description">
753
+
754
+ <p>get values .</p>
755
+ <dl class="rdoc-list label-list"><dt>keys
756
+ <dd>
757
+ <p>key array for get .</p>
758
+ </dd><dt>raw
759
+ <dd>
760
+ <p>If you set this value true, value isn&#39;t Marshal.load value .</p>
761
+ </dd><dt>return
762
+ <dd>
763
+ <p>return key and sotored value hash .</p>
764
+ </dd></dl>
765
+
766
+ <p>If all key doesn&#39;t exist in ROMA, return empty hash . If some key
767
+ doesn&#39;t exist in ROMA, return exist key and sotred value hash .</p>
768
+
769
+ <p>If socket error occured, throw Exception .</p>
770
+
771
+ <p>If socket timeout occured, throw TimeoutError .</p>
772
+
773
+
774
+
775
+
776
+ <div class="method-source-code" id="gets-source">
777
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 320</span>
778
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">gets</span>(<span class="ruby-identifier">keys</span>, <span class="ruby-identifier">raw</span> = <span class="ruby-keyword">false</span>)
779
+ <span class="ruby-identifier">kn</span> = {}
780
+ <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
781
+ <span class="ruby-identifier">nid</span>, <span class="ruby-identifier">d</span> = <span class="ruby-ivar">@rttable</span>.<span class="ruby-identifier">search_node</span>(<span class="ruby-identifier">key</span>)
782
+ <span class="ruby-identifier">kn</span>[<span class="ruby-identifier">nid</span>] <span class="ruby-operator">||=</span> []
783
+ <span class="ruby-identifier">kn</span>[<span class="ruby-identifier">nid</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">key</span>
784
+ }
785
+
786
+ <span class="ruby-identifier">res</span> = {}
787
+ <span class="ruby-identifier">kn</span>.<span class="ruby-identifier">each_pair</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">nid</span>,<span class="ruby-identifier">ks</span><span class="ruby-operator">|</span>
788
+ <span class="ruby-identifier">res</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">gets_sender</span>(<span class="ruby-identifier">nid</span>, <span class="ruby-identifier">ks</span>))
789
+ }
790
+ <span class="ruby-keyword">unless</span> <span class="ruby-identifier">raw</span>
791
+ <span class="ruby-identifier">res</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
792
+ <span class="ruby-identifier">res</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">val</span>)
793
+ <span class="ruby-keyword">end</span>
794
+ <span class="ruby-keyword">end</span>
795
+ <span class="ruby-identifier">res</span>
796
+ <span class="ruby-keyword">end</span></pre>
797
+ </div>
798
+
799
+ </div>
800
+
801
+
802
+
803
+
804
+ </div>
805
+
806
+
807
+ <div id="method-i-incr" class="method-detail ">
808
+
809
+ <div class="method-heading">
810
+ <span class="method-name">incr</span><span
811
+ class="method-args">(key, val = 1)</span>
812
+
813
+ <span class="method-click-advice">click to toggle source</span>
814
+
815
+ </div>
816
+
817
+
818
+ <div class="method-description">
819
+
820
+ <p>increment value .</p>
821
+ <dl class="rdoc-list label-list"><dt>key
822
+ <dd>
823
+ <p>key for incremental .</p>
824
+ </dd><dt>val
825
+ <dd>
826
+ <p>incremental value .</p>
827
+ </dd><dt>return
828
+ <dd>
829
+ <p>Fixnum incrementaled value .</p>
830
+ </dd></dl>
831
+
832
+ <p>If same key doesn&#39;t exist in ROMA, return NOT_FOUND .</p>
833
+
834
+ <p>If socket error occured, throw Exception .</p>
835
+
836
+ <p>If socket timeout occured, throw TimeoutError .</p>
837
+
838
+
839
+
840
+
841
+ <div class="method-source-code" id="incr-source">
842
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 356</span>
843
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">incr</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span> = <span class="ruby-value">1</span>)
844
+ <span class="ruby-identifier">ret</span> = <span class="ruby-identifier">sender</span>(<span class="ruby-value">:oneline_receiver</span>, <span class="ruby-identifier">key</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-string">&quot;incr %s %d&quot;</span>, <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_i</span>)
845
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">ret</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\D/</span>
846
+ <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">to_i</span>
847
+ <span class="ruby-keyword">end</span></pre>
848
+ </div>
849
+
850
+ </div>
851
+
852
+
853
+
854
+
855
+ </div>
856
+
857
+
858
+ <div id="method-i-make_rttable" class="method-detail ">
859
+
860
+ <div class="method-heading">
861
+ <span class="method-name">make_rttable</span><span
862
+ class="method-args">(node)</span>
863
+
864
+ <span class="method-click-advice">click to toggle source</span>
865
+
866
+ </div>
867
+
868
+
869
+ <div class="method-description">
870
+
871
+
872
+
873
+
874
+
875
+
876
+ <div class="method-source-code" id="make_rttable-source">
877
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 80</span>
878
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">make_rttable</span>(<span class="ruby-identifier">node</span>)
879
+ <span class="ruby-identifier">mklhash</span> = <span class="ruby-ivar">@sender</span>.<span class="ruby-identifier">send_route_mklhash_command</span>(<span class="ruby-identifier">node</span>)
880
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">mklhash</span>
881
+
882
+ <span class="ruby-keyword">if</span> <span class="ruby-ivar">@rttable</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@rttable</span>.<span class="ruby-identifier">mklhash</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">mklhash</span>
883
+ <span class="ruby-keyword">return</span> <span class="ruby-ivar">@rttable</span>
884
+ <span class="ruby-keyword">end</span>
885
+
886
+ <span class="ruby-identifier">rd</span> = <span class="ruby-ivar">@sender</span>.<span class="ruby-identifier">send_routedump_command</span>(<span class="ruby-identifier">node</span>)
887
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">rd</span>
888
+ <span class="ruby-identifier">ret</span> = <span class="ruby-constant">ClientRoutingTable</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rd</span>)
889
+ <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">mklhash</span> = <span class="ruby-identifier">mklhash</span>
890
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">ret</span>
891
+ <span class="ruby-keyword">end</span>
892
+ <span class="ruby-keyword">nil</span>
893
+ <span class="ruby-keyword">rescue</span>
894
+ <span class="ruby-keyword">nil</span>
895
+ <span class="ruby-keyword">end</span></pre>
896
+ </div>
897
+
898
+ </div>
899
+
900
+
901
+
902
+
903
+ </div>
904
+
905
+
906
+ <div id="method-i-out" class="method-detail ">
907
+
908
+ <div class="method-heading">
909
+ <span class="method-name">out</span><span
910
+ class="method-args">(key)</span>
911
+
912
+ <span class="method-click-advice">click to toggle source</span>
913
+
914
+ </div>
915
+
916
+
917
+ <div class="method-description">
918
+
919
+ <p>Delete value completely .</p>
920
+
921
+ <p>This method delete value completely. “completely” means Don&#39;t set
922
+ delete flag in server, but delete value in storage . Delete method set
923
+ delete flag, but delete value soon .</p>
924
+ <dl class="rdoc-list label-list"><dt>key
925
+ <dd>
926
+ <p>key for delete .</p>
927
+ </dd><dt>return
928
+ <dd>
929
+ <p>return follow set status .</p>
930
+ </dd></dl>
931
+ <ul><li>
932
+ <p>If method is success, return DELETED .</p>
933
+ </li><li>
934
+ <p>If same key doesn&#39;t exist in ROMA, return NOT_FOUND .</p>
935
+ </li><li>
936
+ <p>If server error, return SERVER_ERROR .</p>
937
+ </li></ul>
938
+
939
+ <p>If socket error occured, throw Exception .</p>
940
+
941
+ <p>If socket timeout occured, throw TimeoutError .</p>
942
+
943
+
944
+
945
+
946
+ <div class="method-source-code" id="out-source">
947
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 286</span>
948
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">out</span>(<span class="ruby-identifier">key</span>)
949
+ <span class="ruby-identifier">sender</span>(<span class="ruby-value">:oneline_receiver</span>, <span class="ruby-identifier">key</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-string">&quot;out %s&quot;</span>)
950
+ <span class="ruby-keyword">end</span></pre>
951
+ </div>
952
+
953
+ </div>
954
+
955
+
956
+
957
+
958
+ </div>
959
+
960
+
961
+ <div id="method-i-prepend" class="method-detail ">
962
+
963
+ <div class="method-heading">
964
+ <span class="method-name">prepend</span><span
965
+ class="method-args">(key, val, expt = 0)</span>
966
+
967
+ <span class="method-click-advice">click to toggle source</span>
968
+
969
+ </div>
970
+
971
+
972
+ <div class="method-description">
973
+
974
+ <p>Prepend value to exists string .</p>
975
+
976
+ <p>If same key exists in ROMA, this method prepend value . If same key
977
+ doesn&#39;t exist in ROMA this method don&#39;t store value and return
978
+ NOT_STORE .</p>
979
+ <dl class="rdoc-list label-list"><dt>key
980
+ <dd>
981
+ <p>key for prepend .</p>
982
+ </dd><dt>value
983
+ <dd>
984
+ <p>prepend value .</p>
985
+ </dd><dt>exp
986
+ <dd>
987
+ <p>expire seconds .</p>
988
+ </dd><dt>return
989
+ <dd>
990
+ <p>return follow set status .</p>
991
+ </dd></dl>
992
+ <ul><li>
993
+ <p>If method is success, return STORED .</p>
994
+ </li><li>
995
+ <p>If same key exists in ROMA, return NOT_STORED .</p>
996
+ </li><li>
997
+ <p>If server error, return SERVER_ERROR .</p>
998
+ </li></ul>
999
+
1000
+ <p>If socket error occured, throw Exception .</p>
1001
+
1002
+ <p>If socket timeout occured, throw TimeoutError .</p>
1003
+
1004
+
1005
+
1006
+
1007
+ <div class="method-source-code" id="prepend-source">
1008
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 224</span>
1009
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">prepend</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">expt</span> = <span class="ruby-value">0</span>)
1010
+ <span class="ruby-identifier">sender</span>(<span class="ruby-value">:oneline_receiver</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-string">&quot;prepend %s 0 %d %d&quot;</span>, <span class="ruby-identifier">expt</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">val</span>.<span class="ruby-identifier">length</span>)
1011
+ <span class="ruby-keyword">end</span></pre>
1012
+ </div>
1013
+
1014
+ </div>
1015
+
1016
+
1017
+
1018
+
1019
+ </div>
1020
+
1021
+
1022
+ <div id="method-i-replace" class="method-detail ">
1023
+
1024
+ <div class="method-heading">
1025
+ <span class="method-name">replace</span><span
1026
+ class="method-args">(key, val, expt = 0, raw = false)</span>
1027
+
1028
+ <span class="method-click-advice">click to toggle source</span>
1029
+
1030
+ </div>
1031
+
1032
+
1033
+ <div class="method-description">
1034
+
1035
+ <p>Add value to ROMA .</p>
1036
+
1037
+ <p>If same key exists in ROMA, this method overwrite value . If same key
1038
+ doesn&#39;t exist in ROMA this method don&#39;t store value and return
1039
+ NOT_STORE .</p>
1040
+ <dl class="rdoc-list label-list"><dt>key
1041
+ <dd>
1042
+ <p>key for store .</p>
1043
+ </dd><dt>value
1044
+ <dd>
1045
+ <p>store value .</p>
1046
+ </dd><dt>exp
1047
+ <dd>
1048
+ <p>expire seconds .</p>
1049
+ </dd><dt>raw
1050
+ <dd>
1051
+ <p>You set this value true, value isn&#39;t marshaled .</p>
1052
+ </dd><dt>return
1053
+ <dd>
1054
+ <p>return follow set status .</p>
1055
+ </dd></dl>
1056
+ <ul><li>
1057
+ <p>If method is success, return STORED .</p>
1058
+ </li><li>
1059
+ <p>If same key exists in ROMA, return NOT_STORED .</p>
1060
+ </li><li>
1061
+ <p>If server error, return SERVER_ERROR .</p>
1062
+ </li></ul>
1063
+
1064
+ <p>If socket error occured, throw Exception .</p>
1065
+
1066
+ <p>If socket timeout occured, throw TimeoutError .</p>
1067
+
1068
+
1069
+
1070
+
1071
+ <div class="method-source-code" id="replace-source">
1072
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 179</span>
1073
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">replace</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">expt</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">raw</span> = <span class="ruby-keyword">false</span>)
1074
+ <span class="ruby-identifier">val</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">val</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">raw</span>
1075
+ <span class="ruby-identifier">sender</span>(<span class="ruby-value">:oneline_receiver</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-string">&quot;replace %s 0 %d %d&quot;</span>, <span class="ruby-identifier">expt</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">val</span>.<span class="ruby-identifier">length</span>)
1076
+ <span class="ruby-keyword">end</span></pre>
1077
+ </div>
1078
+
1079
+ </div>
1080
+
1081
+
1082
+
1083
+
1084
+ </div>
1085
+
1086
+
1087
+ <div id="method-i-rttable_last_update" class="method-detail ">
1088
+
1089
+ <div class="method-heading">
1090
+ <span class="method-name">rttable_last_update</span><span
1091
+ class="method-args">()</span>
1092
+
1093
+ <span class="method-click-advice">click to toggle source</span>
1094
+
1095
+ </div>
1096
+
1097
+
1098
+ <div class="method-description">
1099
+
1100
+
1101
+
1102
+
1103
+
1104
+
1105
+ <div class="method-source-code" id="rttable_last_update-source">
1106
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 76</span>
1107
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">rttable_last_update</span>
1108
+ <span class="ruby-ivar">@rttable_last_update</span>
1109
+ <span class="ruby-keyword">end</span></pre>
1110
+ </div>
1111
+
1112
+ </div>
1113
+
1114
+
1115
+
1116
+
1117
+ </div>
1118
+
1119
+
1120
+ <div id="method-i-set" class="method-detail ">
1121
+
1122
+ <div class="method-heading">
1123
+ <span class="method-name">set</span><span
1124
+ class="method-args">(key, val, expt = 0, raw = false)</span>
1125
+
1126
+ <span class="method-click-advice">click to toggle source</span>
1127
+
1128
+ </div>
1129
+
1130
+
1131
+ <div class="method-description">
1132
+
1133
+ <p>Set value to ROMA .</p>
1134
+
1135
+ <p>Both same same key exists or not exists in ROMA, this method set value .</p>
1136
+ <dl class="rdoc-list label-list"><dt>key
1137
+ <dd>
1138
+ <p>key for store .</p>
1139
+ </dd><dt>value
1140
+ <dd>
1141
+ <p>store value .</p>
1142
+ </dd><dt>exp
1143
+ <dd>
1144
+ <p>expire seconds .</p>
1145
+ </dd><dt>raw
1146
+ <dd>
1147
+ <p>You set this value true, value isn&#39;t marshaled .</p>
1148
+ </dd><dt>return
1149
+ <dd>
1150
+ <p>return follow set status .</p>
1151
+ </dd></dl>
1152
+ <ul><li>
1153
+ <p>If method is success, return STORED .</p>
1154
+ </li><li>
1155
+ <p>If method is not stored, return NOT_STORED .</p>
1156
+ </li><li>
1157
+ <p>If server error, return SERVER_ERROR .</p>
1158
+ </li></ul>
1159
+
1160
+ <p>If socket error occured, throw Exception .</p>
1161
+
1162
+ <p>If socket timeout occured, throw TimeoutError .</p>
1163
+
1164
+
1165
+
1166
+
1167
+ <div class="method-source-code" id="set-source">
1168
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 132</span>
1169
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">expt</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">raw</span> = <span class="ruby-keyword">false</span>)
1170
+ <span class="ruby-identifier">val</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">val</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">raw</span>
1171
+ <span class="ruby-identifier">sender</span>(<span class="ruby-value">:oneline_receiver</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-string">&quot;set %s 0 %d %d&quot;</span>, <span class="ruby-identifier">expt</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">val</span>.<span class="ruby-identifier">length</span>)
1172
+ <span class="ruby-keyword">end</span></pre>
1173
+ </div>
1174
+
1175
+ </div>
1176
+
1177
+
1178
+
1179
+
1180
+ </div>
1181
+
1182
+
1183
+ <div id="method-i-stats" class="method-detail ">
1184
+
1185
+ <div class="method-heading">
1186
+ <span class="method-name">stats</span><span
1187
+ class="method-args">(filter: "", node: @rttable.nodes.first)</span>
1188
+
1189
+ <span class="method-click-advice">click to toggle source</span>
1190
+
1191
+ </div>
1192
+
1193
+
1194
+ <div class="method-description">
1195
+
1196
+
1197
+
1198
+
1199
+
1200
+
1201
+ <div class="method-source-code" id="stats-source">
1202
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 379</span>
1203
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">stats</span>(<span class="ruby-identifier">filter</span><span class="ruby-operator">:</span> <span class="ruby-string">&quot;&quot;</span>, <span class="ruby-identifier">node</span><span class="ruby-operator">:</span> <span class="ruby-ivar">@rttable</span>.<span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">first</span>)
1204
+ <span class="ruby-ivar">@sender</span>.<span class="ruby-identifier">send_stats_command</span>(<span class="ruby-identifier">filter</span>, <span class="ruby-identifier">node</span>)
1205
+ <span class="ruby-keyword">end</span></pre>
1206
+ </div>
1207
+
1208
+ </div>
1209
+
1210
+
1211
+
1212
+
1213
+ </div>
1214
+
1215
+
1216
+ <div id="method-i-update_rttable" class="method-detail ">
1217
+
1218
+ <div class="method-heading">
1219
+ <span class="method-name">update_rttable</span><span
1220
+ class="method-args">(nodes = self.rttable.nodes)</span>
1221
+
1222
+ <span class="method-click-advice">click to toggle source</span>
1223
+
1224
+ </div>
1225
+
1226
+
1227
+ <div class="method-description">
1228
+
1229
+
1230
+
1231
+
1232
+
1233
+
1234
+ <div class="method-source-code" id="update_rttable-source">
1235
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 61</span>
1236
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">update_rttable</span>(<span class="ruby-identifier">nodes</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">rttable</span>.<span class="ruby-identifier">nodes</span>)
1237
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;nodes must not be nil.&quot;</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">nodes</span>
1238
+
1239
+ <span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span>
1240
+ <span class="ruby-identifier">rt</span> = <span class="ruby-identifier">make_rttable</span>(<span class="ruby-identifier">node</span>)
1241
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">rt</span>
1242
+ <span class="ruby-ivar">@rttable</span> = <span class="ruby-identifier">rt</span>
1243
+ <span class="ruby-ivar">@rttable_last_update</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
1244
+ <span class="ruby-keyword">return</span>
1245
+ <span class="ruby-keyword">end</span>
1246
+ }
1247
+
1248
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;fatal error&quot;</span>)
1249
+ <span class="ruby-keyword">end</span></pre>
1250
+ </div>
1251
+
1252
+ </div>
1253
+
1254
+
1255
+
1256
+
1257
+ </div>
1258
+
1259
+
1260
+ <div id="method-i-verbosity" class="method-detail ">
1261
+
1262
+ <div class="method-heading">
1263
+ <span class="method-name">verbosity</span><span
1264
+ class="method-args">()</span>
1265
+
1266
+ <span class="method-click-advice">click to toggle source</span>
1267
+
1268
+ </div>
1269
+
1270
+
1271
+ <div class="method-description">
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+
1278
+ <div class="method-source-code" id="verbosity-source">
1279
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 388</span>
1280
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">verbosity</span>
1281
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;Unsupported yet&quot;</span>) <span class="ruby-comment"># TODO</span>
1282
+ <span class="ruby-ivar">@sender</span>.<span class="ruby-identifier">send_verbosity_command</span>
1283
+ <span class="ruby-keyword">end</span></pre>
1284
+ </div>
1285
+
1286
+ </div>
1287
+
1288
+
1289
+
1290
+
1291
+ </div>
1292
+
1293
+
1294
+ <div id="method-i-version" class="method-detail ">
1295
+
1296
+ <div class="method-heading">
1297
+ <span class="method-name">version</span><span
1298
+ class="method-args">()</span>
1299
+
1300
+ <span class="method-click-advice">click to toggle source</span>
1301
+
1302
+ </div>
1303
+
1304
+
1305
+ <div class="method-description">
1306
+
1307
+
1308
+
1309
+
1310
+
1311
+
1312
+ <div class="method-source-code" id="version-source">
1313
+ <pre><span class="ruby-comment"># File lib/roma/client/rclient.rb, line 383</span>
1314
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">version</span>
1315
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;Unsupported yet&quot;</span>) <span class="ruby-comment"># TODO</span>
1316
+ <span class="ruby-ivar">@sender</span>.<span class="ruby-identifier">send_version_command</span>
1317
+ <span class="ruby-keyword">end</span></pre>
1318
+ </div>
1319
+
1320
+ </div>
1321
+
1322
+
1323
+
1324
+
1325
+ </div>
1326
+
1327
+
1328
+ </section>
1329
+
1330
+ </section>
1331
+ </main>
1332
+
1333
+
1334
+ <footer id="validator-badges" role="contentinfo">
1335
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
1336
+ <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
1337
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
1338
+ </footer>
1339
+