switch_gear 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/README.md +7 -4
- data/docs/SwitchGear.html +127 -0
- data/docs/SwitchGear/CircuitBreaker.html +1004 -0
- data/docs/SwitchGear/CircuitBreaker/Failure.html +448 -0
- data/docs/SwitchGear/CircuitBreaker/Memory.html +929 -0
- data/docs/SwitchGear/CircuitBreaker/OpenError.html +124 -0
- data/docs/SwitchGear/CircuitBreaker/Redis.html +1032 -0
- data/docs/_config.yml +1 -0
- data/docs/_index.html +182 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +492 -0
- data/docs/file.README.html +205 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +205 -0
- data/docs/js/app.js +243 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +315 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/switch_gear.rb +1 -0
- data/lib/switch_gear/circuit_breaker.rb +9 -4
- data/lib/switch_gear/circuit_breaker/failure.rb +2 -2
- data/lib/switch_gear/circuit_breaker/memory.rb +4 -4
- data/lib/switch_gear/circuit_breaker/redis.rb +15 -5
- data/lib/switch_gear/version.rb +1 -1
- metadata +23 -2
@@ -0,0 +1,448 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: SwitchGear::CircuitBreaker::Failure
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.8
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "SwitchGear::CircuitBreaker::Failure";
|
19
|
+
relpath = '../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../_index.html">Index (F)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../SwitchGear.html" title="SwitchGear (module)">SwitchGear</a></span></span> » <span class='title'><span class='object_link'><a href="../CircuitBreaker.html" title="SwitchGear::CircuitBreaker (module)">CircuitBreaker</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Failure</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: SwitchGear::CircuitBreaker::Failure
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">SwitchGear::CircuitBreaker::Failure</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/switch_gear/circuit_breaker/failure.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<h2>
|
111
|
+
Class Method Summary
|
112
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
113
|
+
</h2>
|
114
|
+
|
115
|
+
<ul class="summary">
|
116
|
+
|
117
|
+
<li class="public ">
|
118
|
+
<span class="summary_signature">
|
119
|
+
|
120
|
+
<a href="#from_json-class_method" title="from_json (class method)">.<strong>from_json</strong>(json) ⇒ Object </a>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</span>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
</ul>
|
140
|
+
|
141
|
+
<h2>
|
142
|
+
Instance Method Summary
|
143
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
144
|
+
</h2>
|
145
|
+
|
146
|
+
<ul class="summary">
|
147
|
+
|
148
|
+
<li class="public ">
|
149
|
+
<span class="summary_signature">
|
150
|
+
|
151
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(error, recorded = Time.now.utc) ⇒ Failure </a>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
</span>
|
156
|
+
|
157
|
+
|
158
|
+
<span class="note title constructor">constructor</span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<span class="summary_desc"><div class='inline'>
|
168
|
+
<p>A new instance of Failure.</p>
|
169
|
+
</div></span>
|
170
|
+
|
171
|
+
</li>
|
172
|
+
|
173
|
+
|
174
|
+
<li class="public ">
|
175
|
+
<span class="summary_signature">
|
176
|
+
|
177
|
+
<a href="#timestamp-instance_method" title="#timestamp (instance method)">#<strong>timestamp</strong> ⇒ Object </a>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
</span>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
192
|
+
|
193
|
+
</li>
|
194
|
+
|
195
|
+
|
196
|
+
<li class="public ">
|
197
|
+
<span class="summary_signature">
|
198
|
+
|
199
|
+
<a href="#to_json-instance_method" title="#to_json (instance method)">#<strong>to_json</strong> ⇒ Object </a>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
</span>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
214
|
+
|
215
|
+
</li>
|
216
|
+
|
217
|
+
|
218
|
+
<li class="public ">
|
219
|
+
<span class="summary_signature">
|
220
|
+
|
221
|
+
<a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> ⇒ Object </a>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
</span>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
236
|
+
|
237
|
+
</li>
|
238
|
+
|
239
|
+
|
240
|
+
</ul>
|
241
|
+
|
242
|
+
|
243
|
+
<div id="constructor_details" class="method_details_list">
|
244
|
+
<h2>Constructor Details</h2>
|
245
|
+
|
246
|
+
<div class="method_details first">
|
247
|
+
<h3 class="signature first" id="initialize-instance_method">
|
248
|
+
|
249
|
+
#<strong>initialize</strong>(error, recorded = Time.now.utc) ⇒ <tt><span class='object_link'><a href="" title="SwitchGear::CircuitBreaker::Failure (class)">Failure</a></span></tt>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
</h3><div class="docstring">
|
256
|
+
<div class="discussion">
|
257
|
+
|
258
|
+
<p>Returns a new instance of Failure</p>
|
259
|
+
|
260
|
+
|
261
|
+
</div>
|
262
|
+
</div>
|
263
|
+
<div class="tags">
|
264
|
+
|
265
|
+
|
266
|
+
</div><table class="source_code">
|
267
|
+
<tr>
|
268
|
+
<td>
|
269
|
+
<pre class="lines">
|
270
|
+
|
271
|
+
|
272
|
+
12
|
273
|
+
13
|
274
|
+
14
|
275
|
+
15</pre>
|
276
|
+
</td>
|
277
|
+
<td>
|
278
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/failure.rb', line 12</span>
|
279
|
+
|
280
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='comma'>,</span> <span class='id identifier rubyid_recorded'>recorded</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='rparen'>)</span>
|
281
|
+
<span class='ivar'>@error</span> <span class='op'>=</span> <span class='id identifier rubyid_error'>error</span>
|
282
|
+
<span class='ivar'>@recorded</span> <span class='op'>=</span> <span class='id identifier rubyid_recorded'>recorded</span>
|
283
|
+
<span class='kw'>end</span></pre>
|
284
|
+
</td>
|
285
|
+
</tr>
|
286
|
+
</table>
|
287
|
+
</div>
|
288
|
+
|
289
|
+
</div>
|
290
|
+
|
291
|
+
|
292
|
+
<div id="class_method_details" class="method_details_list">
|
293
|
+
<h2>Class Method Details</h2>
|
294
|
+
|
295
|
+
|
296
|
+
<div class="method_details first">
|
297
|
+
<h3 class="signature first" id="from_json-class_method">
|
298
|
+
|
299
|
+
.<strong>from_json</strong>(json) ⇒ <tt>Object</tt>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
</h3><table class="source_code">
|
306
|
+
<tr>
|
307
|
+
<td>
|
308
|
+
<pre class="lines">
|
309
|
+
|
310
|
+
|
311
|
+
5
|
312
|
+
6
|
313
|
+
7
|
314
|
+
8
|
315
|
+
9
|
316
|
+
10</pre>
|
317
|
+
</td>
|
318
|
+
<td>
|
319
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/failure.rb', line 5</span>
|
320
|
+
|
321
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_from_json'>from_json</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
322
|
+
<span class='id identifier rubyid_failure'>failure</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span>
|
323
|
+
<span class='id identifier rubyid_error'>error</span> <span class='op'>=</span> <span class='const'>Object</span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='id identifier rubyid_failure'>failure</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>error</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
324
|
+
<span class='id identifier rubyid_error'>error</span> <span class='op'>=</span> <span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_failure'>failure</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>message</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
325
|
+
<span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='comma'>,</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_failure'>failure</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>timestamp</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
326
|
+
<span class='kw'>end</span></pre>
|
327
|
+
</td>
|
328
|
+
</tr>
|
329
|
+
</table>
|
330
|
+
</div>
|
331
|
+
|
332
|
+
</div>
|
333
|
+
|
334
|
+
<div id="instance_method_details" class="method_details_list">
|
335
|
+
<h2>Instance Method Details</h2>
|
336
|
+
|
337
|
+
|
338
|
+
<div class="method_details first">
|
339
|
+
<h3 class="signature first" id="timestamp-instance_method">
|
340
|
+
|
341
|
+
#<strong>timestamp</strong> ⇒ <tt>Object</tt>
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
</h3><table class="source_code">
|
348
|
+
<tr>
|
349
|
+
<td>
|
350
|
+
<pre class="lines">
|
351
|
+
|
352
|
+
|
353
|
+
17
|
354
|
+
18
|
355
|
+
19</pre>
|
356
|
+
</td>
|
357
|
+
<td>
|
358
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/failure.rb', line 17</span>
|
359
|
+
|
360
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_timestamp'>timestamp</span>
|
361
|
+
<span class='id identifier rubyid_recorded'>recorded</span>
|
362
|
+
<span class='kw'>end</span></pre>
|
363
|
+
</td>
|
364
|
+
</tr>
|
365
|
+
</table>
|
366
|
+
</div>
|
367
|
+
|
368
|
+
<div class="method_details ">
|
369
|
+
<h3 class="signature " id="to_json-instance_method">
|
370
|
+
|
371
|
+
#<strong>to_json</strong> ⇒ <tt>Object</tt>
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
</h3><table class="source_code">
|
378
|
+
<tr>
|
379
|
+
<td>
|
380
|
+
<pre class="lines">
|
381
|
+
|
382
|
+
|
383
|
+
25
|
384
|
+
26
|
385
|
+
27
|
386
|
+
28
|
387
|
+
29
|
388
|
+
30
|
389
|
+
31</pre>
|
390
|
+
</td>
|
391
|
+
<td>
|
392
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/failure.rb', line 25</span>
|
393
|
+
|
394
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_json'>to_json</span>
|
395
|
+
<span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_generate'>generate</span><span class='lparen'>(</span><span class='lbrace'>{</span>
|
396
|
+
<span class='label'>error:</span> <span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='comma'>,</span>
|
397
|
+
<span class='label'>message:</span> <span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span>
|
398
|
+
<span class='label'>timestamp:</span> <span class='id identifier rubyid_timestamp'>timestamp</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
399
|
+
<span class='rbrace'>}</span><span class='rparen'>)</span>
|
400
|
+
<span class='kw'>end</span></pre>
|
401
|
+
</td>
|
402
|
+
</tr>
|
403
|
+
</table>
|
404
|
+
</div>
|
405
|
+
|
406
|
+
<div class="method_details ">
|
407
|
+
<h3 class="signature " id="to_s-instance_method">
|
408
|
+
|
409
|
+
#<strong>to_s</strong> ⇒ <tt>Object</tt>
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
</h3><table class="source_code">
|
416
|
+
<tr>
|
417
|
+
<td>
|
418
|
+
<pre class="lines">
|
419
|
+
|
420
|
+
|
421
|
+
21
|
422
|
+
22
|
423
|
+
23</pre>
|
424
|
+
</td>
|
425
|
+
<td>
|
426
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/failure.rb', line 21</span>
|
427
|
+
|
428
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
|
429
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='embexpr_end'>}</span><span class='tstring_content'>] - </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
430
|
+
<span class='kw'>end</span></pre>
|
431
|
+
</td>
|
432
|
+
</tr>
|
433
|
+
</table>
|
434
|
+
</div>
|
435
|
+
|
436
|
+
</div>
|
437
|
+
|
438
|
+
</div>
|
439
|
+
|
440
|
+
<div id="footer">
|
441
|
+
Generated on Fri May 26 06:53:24 2017 by
|
442
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
443
|
+
0.9.8 (ruby-2.4.0).
|
444
|
+
</div>
|
445
|
+
|
446
|
+
</div>
|
447
|
+
</body>
|
448
|
+
</html>
|
@@ -0,0 +1,929 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: SwitchGear::CircuitBreaker::Memory
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.8
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "SwitchGear::CircuitBreaker::Memory";
|
19
|
+
relpath = '../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../_index.html">Index (M)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../SwitchGear.html" title="SwitchGear (module)">SwitchGear</a></span></span> » <span class='title'><span class='object_link'><a href="../CircuitBreaker.html" title="SwitchGear::CircuitBreaker (module)">CircuitBreaker</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Memory</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: SwitchGear::CircuitBreaker::Memory
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">SwitchGear::CircuitBreaker::Memory</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<dl>
|
91
|
+
<dt>Includes:</dt>
|
92
|
+
<dd><span class='object_link'><a href="../CircuitBreaker.html" title="SwitchGear::CircuitBreaker (module)">SwitchGear::CircuitBreaker</a></span></dd>
|
93
|
+
</dl>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dl>
|
101
|
+
<dt>Defined in:</dt>
|
102
|
+
<dd>lib/switch_gear/circuit_breaker/memory.rb</dd>
|
103
|
+
</dl>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
112
|
+
<ul class="summary">
|
113
|
+
|
114
|
+
<li class="public ">
|
115
|
+
<span class="summary_signature">
|
116
|
+
|
117
|
+
<a href="#circuit-instance_method" title="#circuit (instance method)">#<strong>circuit</strong> ⇒ Proc/Lambda </a>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
</span>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<span class="summary_desc"><div class='inline'>
|
135
|
+
<p>The main runner, must respond to #call.</p>
|
136
|
+
</div></span>
|
137
|
+
|
138
|
+
</li>
|
139
|
+
|
140
|
+
|
141
|
+
<li class="public ">
|
142
|
+
<span class="summary_signature">
|
143
|
+
|
144
|
+
<a href="#failure_limit-instance_method" title="#failure_limit (instance method)">#<strong>failure_limit</strong> ⇒ Integer </a>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
</span>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<span class="summary_desc"><div class='inline'>
|
162
|
+
<p>The count of failures.</p>
|
163
|
+
</div></span>
|
164
|
+
|
165
|
+
</li>
|
166
|
+
|
167
|
+
|
168
|
+
<li class="public ">
|
169
|
+
<span class="summary_signature">
|
170
|
+
|
171
|
+
<a href="#failures-instance_method" title="#failures (instance method)">#<strong>failures</strong> ⇒ Array<CircuitBreaker::Failure> </a>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
</span>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
<span class="summary_desc"><div class='inline'>
|
189
|
+
<p>The current failures.</p>
|
190
|
+
</div></span>
|
191
|
+
|
192
|
+
</li>
|
193
|
+
|
194
|
+
|
195
|
+
<li class="public ">
|
196
|
+
<span class="summary_signature">
|
197
|
+
|
198
|
+
<a href="#logger-instance_method" title="#logger (instance method)">#<strong>logger</strong> ⇒ Object </a>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
</span>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<span class="summary_desc"><div class='inline'>
|
216
|
+
<p>The current logger.</p>
|
217
|
+
</div></span>
|
218
|
+
|
219
|
+
</li>
|
220
|
+
|
221
|
+
|
222
|
+
<li class="public ">
|
223
|
+
<span class="summary_signature">
|
224
|
+
|
225
|
+
<a href="#reset_timeout-instance_method" title="#reset_timeout (instance method)">#<strong>reset_timeout</strong> ⇒ Integer </a>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
</span>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<span class="summary_desc"><div class='inline'>
|
243
|
+
<p>The amount of time in seconds before a breaker should reset if currently
|
244
|
+
open.</p>
|
245
|
+
</div></span>
|
246
|
+
|
247
|
+
</li>
|
248
|
+
|
249
|
+
|
250
|
+
<li class="public ">
|
251
|
+
<span class="summary_signature">
|
252
|
+
|
253
|
+
<a href="#state-instance_method" title="#state (instance method)">#<strong>state</strong> ⇒ Symbol </a>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
</span>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
<span class="summary_desc"><div class='inline'>
|
271
|
+
<p>The current state.</p>
|
272
|
+
</div></span>
|
273
|
+
|
274
|
+
</li>
|
275
|
+
|
276
|
+
|
277
|
+
</ul>
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
<h2>
|
284
|
+
Instance Method Summary
|
285
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
286
|
+
</h2>
|
287
|
+
|
288
|
+
<ul class="summary">
|
289
|
+
|
290
|
+
<li class="public ">
|
291
|
+
<span class="summary_signature">
|
292
|
+
|
293
|
+
<a href="#add_failure-instance_method" title="#add_failure (instance method)">#<strong>add_failure</strong>(failure) ⇒ Object </a>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
</span>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
<span class="summary_desc"><div class='inline'>
|
308
|
+
<p>(look to add_failure).</p>
|
309
|
+
</div></span>
|
310
|
+
|
311
|
+
</li>
|
312
|
+
|
313
|
+
|
314
|
+
<li class="public ">
|
315
|
+
<span class="summary_signature">
|
316
|
+
|
317
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> {|circuit, failure_limit, reset_timeout, logger| ... } ⇒ SwitchGear::CircuitBreaker::Memory </a>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
</span>
|
322
|
+
|
323
|
+
|
324
|
+
<span class="note title constructor">constructor</span>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
<span class="summary_desc"><div class='inline'>
|
334
|
+
<p>The object.</p>
|
335
|
+
</div></span>
|
336
|
+
|
337
|
+
</li>
|
338
|
+
|
339
|
+
|
340
|
+
</ul>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="../CircuitBreaker.html" title="SwitchGear::CircuitBreaker (module)">SwitchGear::CircuitBreaker</a></span></h3>
|
353
|
+
<p class="inherited"><span class='object_link'><a href="../CircuitBreaker.html#call-instance_method" title="SwitchGear::CircuitBreaker#call (method)">#call</a></span>, <span class='object_link'><a href="../CircuitBreaker.html#closed%3F-instance_method" title="SwitchGear::CircuitBreaker#closed? (method)">#closed?</a></span>, <span class='object_link'><a href="../CircuitBreaker.html#failure_count-instance_method" title="SwitchGear::CircuitBreaker#failure_count (method)">#failure_count</a></span>, <span class='object_link'><a href="../CircuitBreaker.html#half_open%3F-instance_method" title="SwitchGear::CircuitBreaker#half_open? (method)">#half_open?</a></span>, <span class='object_link'><a href="../CircuitBreaker.html#open%3F-instance_method" title="SwitchGear::CircuitBreaker#open? (method)">#open?</a></span></p>
|
354
|
+
<div id="constructor_details" class="method_details_list">
|
355
|
+
<h2>Constructor Details</h2>
|
356
|
+
|
357
|
+
<div class="method_details first">
|
358
|
+
<h3 class="signature first" id="initialize-instance_method">
|
359
|
+
|
360
|
+
#<strong>initialize</strong> {|circuit, failure_limit, reset_timeout, logger| ... } ⇒ <tt><span class='object_link'><a href="" title="SwitchGear::CircuitBreaker::Memory (class)">SwitchGear::CircuitBreaker::Memory</a></span></tt>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
</h3><div class="docstring">
|
367
|
+
<div class="discussion">
|
368
|
+
|
369
|
+
<p>Returns the object.</p>
|
370
|
+
|
371
|
+
|
372
|
+
</div>
|
373
|
+
</div>
|
374
|
+
<div class="tags">
|
375
|
+
|
376
|
+
<div class="examples">
|
377
|
+
<p class="tag_title">Examples:</p>
|
378
|
+
|
379
|
+
|
380
|
+
<p class="example_title"><div class='inline'>
|
381
|
+
<p>create a new breaker</p>
|
382
|
+
</div></p>
|
383
|
+
|
384
|
+
<pre class="example code"><code><span class='id identifier rubyid_breaker'>breaker</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../SwitchGear.html" title="SwitchGear (module)">SwitchGear</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../CircuitBreaker.html" title="SwitchGear::CircuitBreaker (module)">CircuitBreaker</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="SwitchGear::CircuitBreaker::Memory (class)">Memory</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_cb'>cb</span><span class='op'>|</span>
|
385
|
+
<span class='id identifier rubyid_cb'>cb</span><span class='period'>.</span><span class='id identifier rubyid_circuit'>circuit</span> <span class='op'>=</span> <span class='tlambda'>-></span> <span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='id identifier rubyid_my_method'>my_method</span><span class='lparen'>(</span><span class='id identifier rubyid_arg'>arg</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
386
|
+
<span class='id identifier rubyid_cb'>cb</span><span class='period'>.</span><span class='id identifier rubyid_failure_limit'>failure_limit</span> <span class='op'>=</span> <span class='int'>2</span>
|
387
|
+
<span class='id identifier rubyid_cb'>cb</span><span class='period'>.</span><span class='id identifier rubyid_reset_timeout'>reset_timeout</span> <span class='op'>=</span> <span class='int'>5</span>
|
388
|
+
<span class='kw'>end</span></code></pre>
|
389
|
+
|
390
|
+
</div>
|
391
|
+
|
392
|
+
<p class="tag_title">Yield Parameters:</p>
|
393
|
+
<ul class="yieldparam">
|
394
|
+
|
395
|
+
<li>
|
396
|
+
|
397
|
+
<span class='name'>circuit</span>
|
398
|
+
|
399
|
+
|
400
|
+
<span class='type'></span>
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
—
|
405
|
+
<div class='inline'><ul><li>
|
406
|
+
<p>(look to <span class='object_link'><a href="#circuit-instance_method" title="SwitchGear::CircuitBreaker::Memory#circuit (method)">#circuit</a></span>)</p>
|
407
|
+
</li></ul>
|
408
|
+
</div>
|
409
|
+
|
410
|
+
</li>
|
411
|
+
|
412
|
+
<li>
|
413
|
+
|
414
|
+
<span class='name'>failure_limit</span>
|
415
|
+
|
416
|
+
|
417
|
+
<span class='type'></span>
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
—
|
422
|
+
<div class='inline'><ul><li>
|
423
|
+
<p>(look to <span class='object_link'><a href="#failure_limit-instance_method" title="SwitchGear::CircuitBreaker::Memory#failure_limit (method)">#failure_limit</a></span>)</p>
|
424
|
+
</li></ul>
|
425
|
+
</div>
|
426
|
+
|
427
|
+
</li>
|
428
|
+
|
429
|
+
<li>
|
430
|
+
|
431
|
+
<span class='name'>reset_timeout</span>
|
432
|
+
|
433
|
+
|
434
|
+
<span class='type'></span>
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
—
|
439
|
+
<div class='inline'><ul><li>
|
440
|
+
<p>(look to <span class='object_link'><a href="#reset_timeout-instance_method" title="SwitchGear::CircuitBreaker::Memory#reset_timeout (method)">#reset_timeout</a></span>)</p>
|
441
|
+
</li></ul>
|
442
|
+
</div>
|
443
|
+
|
444
|
+
</li>
|
445
|
+
|
446
|
+
<li>
|
447
|
+
|
448
|
+
<span class='name'>logger</span>
|
449
|
+
|
450
|
+
|
451
|
+
<span class='type'></span>
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
—
|
456
|
+
<div class='inline'><ul><li>
|
457
|
+
<p>(look to <span class='object_link'><a href="#logger-instance_method" title="SwitchGear::CircuitBreaker::Memory#logger (method)">#logger</a></span>)</p>
|
458
|
+
</li></ul>
|
459
|
+
</div>
|
460
|
+
|
461
|
+
</li>
|
462
|
+
|
463
|
+
</ul>
|
464
|
+
|
465
|
+
</div><table class="source_code">
|
466
|
+
<tr>
|
467
|
+
<td>
|
468
|
+
<pre class="lines">
|
469
|
+
|
470
|
+
|
471
|
+
38
|
472
|
+
39
|
473
|
+
40
|
474
|
+
41
|
475
|
+
42
|
476
|
+
43
|
477
|
+
44
|
478
|
+
45
|
479
|
+
46</pre>
|
480
|
+
</td>
|
481
|
+
<td>
|
482
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/memory.rb', line 38</span>
|
483
|
+
|
484
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
485
|
+
<span class='kw'>yield</span> <span class='kw'>self</span>
|
486
|
+
<span class='ivar'>@failure_limit</span> <span class='op'>||=</span> <span class='int'>5</span>
|
487
|
+
<span class='ivar'>@reset_timeout</span> <span class='op'>||=</span> <span class='int'>10</span>
|
488
|
+
<span class='ivar'>@logger</span> <span class='op'>||=</span> <span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>STDOUT</span><span class='rparen'>)</span>
|
489
|
+
<span class='ivar'>@state</span> <span class='op'>=</span> <span class='symbol'>:closed</span>
|
490
|
+
<span class='ivar'>@failures</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
491
|
+
<span class='id identifier rubyid_run_validations'>run_validations</span>
|
492
|
+
<span class='kw'>end</span></pre>
|
493
|
+
</td>
|
494
|
+
</tr>
|
495
|
+
</table>
|
496
|
+
</div>
|
497
|
+
|
498
|
+
</div>
|
499
|
+
|
500
|
+
<div id="instance_attr_details" class="attr_details">
|
501
|
+
<h2>Instance Attribute Details</h2>
|
502
|
+
|
503
|
+
|
504
|
+
<span id="circuit=-instance_method"></span>
|
505
|
+
<div class="method_details first">
|
506
|
+
<h3 class="signature first" id="circuit-instance_method">
|
507
|
+
|
508
|
+
#<strong>circuit</strong> ⇒ <tt>Proc/Lambda</tt>
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
</h3><div class="docstring">
|
515
|
+
<div class="discussion">
|
516
|
+
|
517
|
+
<p>The main runner, must respond to #call</p>
|
518
|
+
|
519
|
+
|
520
|
+
</div>
|
521
|
+
</div>
|
522
|
+
<div class="tags">
|
523
|
+
|
524
|
+
<p class="tag_title">Returns:</p>
|
525
|
+
<ul class="return">
|
526
|
+
|
527
|
+
<li>
|
528
|
+
|
529
|
+
|
530
|
+
<span class='type'>(<tt>Proc/Lambda</tt>)</span>
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
—
|
535
|
+
<div class='inline'>
|
536
|
+
<p>the runner</p>
|
537
|
+
</div>
|
538
|
+
|
539
|
+
</li>
|
540
|
+
|
541
|
+
</ul>
|
542
|
+
|
543
|
+
</div><table class="source_code">
|
544
|
+
<tr>
|
545
|
+
<td>
|
546
|
+
<pre class="lines">
|
547
|
+
|
548
|
+
|
549
|
+
8
|
550
|
+
9
|
551
|
+
10</pre>
|
552
|
+
</td>
|
553
|
+
<td>
|
554
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/memory.rb', line 8</span>
|
555
|
+
|
556
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_circuit'>circuit</span>
|
557
|
+
<span class='ivar'>@circuit</span>
|
558
|
+
<span class='kw'>end</span></pre>
|
559
|
+
</td>
|
560
|
+
</tr>
|
561
|
+
</table>
|
562
|
+
</div>
|
563
|
+
|
564
|
+
|
565
|
+
<span id="failure_limit=-instance_method"></span>
|
566
|
+
<div class="method_details ">
|
567
|
+
<h3 class="signature " id="failure_limit-instance_method">
|
568
|
+
|
569
|
+
#<strong>failure_limit</strong> ⇒ <tt>Integer</tt>
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
</h3><div class="docstring">
|
576
|
+
<div class="discussion">
|
577
|
+
|
578
|
+
<p>The count of failures</p>
|
579
|
+
|
580
|
+
|
581
|
+
</div>
|
582
|
+
</div>
|
583
|
+
<div class="tags">
|
584
|
+
|
585
|
+
<p class="tag_title">Returns:</p>
|
586
|
+
<ul class="return">
|
587
|
+
|
588
|
+
<li>
|
589
|
+
|
590
|
+
|
591
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
592
|
+
|
593
|
+
|
594
|
+
|
595
|
+
—
|
596
|
+
<div class='inline'>
|
597
|
+
<p>the amount of failures to permit. Defaults to 10 seconds.</p>
|
598
|
+
</div>
|
599
|
+
|
600
|
+
</li>
|
601
|
+
|
602
|
+
</ul>
|
603
|
+
|
604
|
+
</div><table class="source_code">
|
605
|
+
<tr>
|
606
|
+
<td>
|
607
|
+
<pre class="lines">
|
608
|
+
|
609
|
+
|
610
|
+
11
|
611
|
+
12
|
612
|
+
13</pre>
|
613
|
+
</td>
|
614
|
+
<td>
|
615
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/memory.rb', line 11</span>
|
616
|
+
|
617
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_failure_limit'>failure_limit</span>
|
618
|
+
<span class='ivar'>@failure_limit</span>
|
619
|
+
<span class='kw'>end</span></pre>
|
620
|
+
</td>
|
621
|
+
</tr>
|
622
|
+
</table>
|
623
|
+
</div>
|
624
|
+
|
625
|
+
|
626
|
+
<span id="failures=-instance_method"></span>
|
627
|
+
<div class="method_details ">
|
628
|
+
<h3 class="signature " id="failures-instance_method">
|
629
|
+
|
630
|
+
#<strong>failures</strong> ⇒ <tt>Array<<span class='object_link'><a href="Failure.html" title="SwitchGear::CircuitBreaker::Failure (class)">CircuitBreaker::Failure</a></span>></tt>
|
631
|
+
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
</h3><div class="docstring">
|
637
|
+
<div class="discussion">
|
638
|
+
|
639
|
+
<p>The current failures</p>
|
640
|
+
|
641
|
+
|
642
|
+
</div>
|
643
|
+
</div>
|
644
|
+
<div class="tags">
|
645
|
+
|
646
|
+
<p class="tag_title">Returns:</p>
|
647
|
+
<ul class="return">
|
648
|
+
|
649
|
+
<li>
|
650
|
+
|
651
|
+
|
652
|
+
<span class='type'>(<tt>Array<<span class='object_link'><a href="Failure.html" title="SwitchGear::CircuitBreaker::Failure (class)">CircuitBreaker::Failure</a></span>></tt>)</span>
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
—
|
657
|
+
<div class='inline'><ul><li>
|
658
|
+
<p>a list of failures serialized.</p>
|
659
|
+
</li></ul>
|
660
|
+
</div>
|
661
|
+
|
662
|
+
</li>
|
663
|
+
|
664
|
+
</ul>
|
665
|
+
|
666
|
+
</div><table class="source_code">
|
667
|
+
<tr>
|
668
|
+
<td>
|
669
|
+
<pre class="lines">
|
670
|
+
|
671
|
+
|
672
|
+
24
|
673
|
+
25
|
674
|
+
26</pre>
|
675
|
+
</td>
|
676
|
+
<td>
|
677
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/memory.rb', line 24</span>
|
678
|
+
|
679
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_failures'>failures</span>
|
680
|
+
<span class='ivar'>@failures</span>
|
681
|
+
<span class='kw'>end</span></pre>
|
682
|
+
</td>
|
683
|
+
</tr>
|
684
|
+
</table>
|
685
|
+
</div>
|
686
|
+
|
687
|
+
|
688
|
+
<span id="logger=-instance_method"></span>
|
689
|
+
<div class="method_details ">
|
690
|
+
<h3 class="signature " id="logger-instance_method">
|
691
|
+
|
692
|
+
#<strong>logger</strong> ⇒ <tt>Object</tt>
|
693
|
+
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
|
698
|
+
</h3><div class="docstring">
|
699
|
+
<div class="discussion">
|
700
|
+
|
701
|
+
<p>The current logger</p>
|
702
|
+
|
703
|
+
|
704
|
+
</div>
|
705
|
+
</div>
|
706
|
+
<div class="tags">
|
707
|
+
|
708
|
+
<p class="tag_title">Returns:</p>
|
709
|
+
<ul class="return">
|
710
|
+
|
711
|
+
<li>
|
712
|
+
|
713
|
+
|
714
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
—
|
719
|
+
<div class='inline'><ul><li>
|
720
|
+
<p>The logger sent in at initialization. Defaults to ruby's std Logger
|
721
|
+
class.</p>
|
722
|
+
</li></ul>
|
723
|
+
</div>
|
724
|
+
|
725
|
+
</li>
|
726
|
+
|
727
|
+
</ul>
|
728
|
+
|
729
|
+
</div><table class="source_code">
|
730
|
+
<tr>
|
731
|
+
<td>
|
732
|
+
<pre class="lines">
|
733
|
+
|
734
|
+
|
735
|
+
17
|
736
|
+
18
|
737
|
+
19</pre>
|
738
|
+
</td>
|
739
|
+
<td>
|
740
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/memory.rb', line 17</span>
|
741
|
+
|
742
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span>
|
743
|
+
<span class='ivar'>@logger</span>
|
744
|
+
<span class='kw'>end</span></pre>
|
745
|
+
</td>
|
746
|
+
</tr>
|
747
|
+
</table>
|
748
|
+
</div>
|
749
|
+
|
750
|
+
|
751
|
+
<span id="reset_timeout=-instance_method"></span>
|
752
|
+
<div class="method_details ">
|
753
|
+
<h3 class="signature " id="reset_timeout-instance_method">
|
754
|
+
|
755
|
+
#<strong>reset_timeout</strong> ⇒ <tt>Integer</tt>
|
756
|
+
|
757
|
+
|
758
|
+
|
759
|
+
|
760
|
+
|
761
|
+
</h3><div class="docstring">
|
762
|
+
<div class="discussion">
|
763
|
+
|
764
|
+
<p>The amount of time in seconds before a breaker should reset if currently
|
765
|
+
open. Defaults to 5.</p>
|
766
|
+
|
767
|
+
|
768
|
+
</div>
|
769
|
+
</div>
|
770
|
+
<div class="tags">
|
771
|
+
|
772
|
+
<p class="tag_title">Returns:</p>
|
773
|
+
<ul class="return">
|
774
|
+
|
775
|
+
<li>
|
776
|
+
|
777
|
+
|
778
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
779
|
+
|
780
|
+
|
781
|
+
|
782
|
+
</li>
|
783
|
+
|
784
|
+
</ul>
|
785
|
+
|
786
|
+
</div><table class="source_code">
|
787
|
+
<tr>
|
788
|
+
<td>
|
789
|
+
<pre class="lines">
|
790
|
+
|
791
|
+
|
792
|
+
14
|
793
|
+
15
|
794
|
+
16</pre>
|
795
|
+
</td>
|
796
|
+
<td>
|
797
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/memory.rb', line 14</span>
|
798
|
+
|
799
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reset_timeout'>reset_timeout</span>
|
800
|
+
<span class='ivar'>@reset_timeout</span>
|
801
|
+
<span class='kw'>end</span></pre>
|
802
|
+
</td>
|
803
|
+
</tr>
|
804
|
+
</table>
|
805
|
+
</div>
|
806
|
+
|
807
|
+
|
808
|
+
<span id="state=-instance_method"></span>
|
809
|
+
<div class="method_details ">
|
810
|
+
<h3 class="signature " id="state-instance_method">
|
811
|
+
|
812
|
+
#<strong>state</strong> ⇒ <tt>Symbol</tt>
|
813
|
+
|
814
|
+
|
815
|
+
|
816
|
+
|
817
|
+
|
818
|
+
</h3><div class="docstring">
|
819
|
+
<div class="discussion">
|
820
|
+
|
821
|
+
<p>The current state</p>
|
822
|
+
|
823
|
+
|
824
|
+
</div>
|
825
|
+
</div>
|
826
|
+
<div class="tags">
|
827
|
+
|
828
|
+
<p class="tag_title">Returns:</p>
|
829
|
+
<ul class="return">
|
830
|
+
|
831
|
+
<li>
|
832
|
+
|
833
|
+
|
834
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
835
|
+
|
836
|
+
|
837
|
+
|
838
|
+
—
|
839
|
+
<div class='inline'>
|
840
|
+
<p>should always return either :open, :closed or :half-open. Use the helper
|
841
|
+
methods in lib/circuit_breaker.rb for more readable code.</p>
|
842
|
+
</div>
|
843
|
+
|
844
|
+
</li>
|
845
|
+
|
846
|
+
</ul>
|
847
|
+
|
848
|
+
</div><table class="source_code">
|
849
|
+
<tr>
|
850
|
+
<td>
|
851
|
+
<pre class="lines">
|
852
|
+
|
853
|
+
|
854
|
+
21
|
855
|
+
22
|
856
|
+
23</pre>
|
857
|
+
</td>
|
858
|
+
<td>
|
859
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/memory.rb', line 21</span>
|
860
|
+
|
861
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_state'>state</span>
|
862
|
+
<span class='ivar'>@state</span>
|
863
|
+
<span class='kw'>end</span></pre>
|
864
|
+
</td>
|
865
|
+
</tr>
|
866
|
+
</table>
|
867
|
+
</div>
|
868
|
+
|
869
|
+
</div>
|
870
|
+
|
871
|
+
|
872
|
+
<div id="instance_method_details" class="method_details_list">
|
873
|
+
<h2>Instance Method Details</h2>
|
874
|
+
|
875
|
+
|
876
|
+
<div class="method_details first">
|
877
|
+
<h3 class="signature first" id="add_failure-instance_method">
|
878
|
+
|
879
|
+
#<strong>add_failure</strong>(failure) ⇒ <tt>Object</tt>
|
880
|
+
|
881
|
+
|
882
|
+
|
883
|
+
|
884
|
+
|
885
|
+
</h3><div class="docstring">
|
886
|
+
<div class="discussion">
|
887
|
+
|
888
|
+
<p>(look to add_failure)</p>
|
889
|
+
|
890
|
+
|
891
|
+
</div>
|
892
|
+
</div>
|
893
|
+
<div class="tags">
|
894
|
+
|
895
|
+
|
896
|
+
</div><table class="source_code">
|
897
|
+
<tr>
|
898
|
+
<td>
|
899
|
+
<pre class="lines">
|
900
|
+
|
901
|
+
|
902
|
+
49
|
903
|
+
50
|
904
|
+
51</pre>
|
905
|
+
</td>
|
906
|
+
<td>
|
907
|
+
<pre class="code"><span class="info file"># File 'lib/switch_gear/circuit_breaker/memory.rb', line 49</span>
|
908
|
+
|
909
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_add_failure'>add_failure</span><span class='lparen'>(</span><span class='id identifier rubyid_failure'>failure</span><span class='rparen'>)</span>
|
910
|
+
<span class='id identifier rubyid_failures'>failures</span> <span class='op'><<</span> <span class='id identifier rubyid_failure'>failure</span>
|
911
|
+
<span class='kw'>end</span></pre>
|
912
|
+
</td>
|
913
|
+
</tr>
|
914
|
+
</table>
|
915
|
+
</div>
|
916
|
+
|
917
|
+
</div>
|
918
|
+
|
919
|
+
</div>
|
920
|
+
|
921
|
+
<div id="footer">
|
922
|
+
Generated on Fri May 26 06:53:24 2017 by
|
923
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
924
|
+
0.9.8 (ruby-2.4.0).
|
925
|
+
</div>
|
926
|
+
|
927
|
+
</div>
|
928
|
+
</body>
|
929
|
+
</html>
|