celluloid-coordinator 0.0.1.pre0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +5 -0
- data/.rubocop.yml +412 -0
- data/.travis.yml +20 -0
- data/CHANGES.md +0 -0
- data/Gemfile +26 -0
- data/LICENSE +22 -0
- data/README.md +9 -0
- data/Rakefile +8 -0
- data/celluloid-coordinator.gemspec +24 -0
- data/lib/celluloid/coordinator.rb +63 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 152f685001ae257af42be776613dfc33801a8015
|
4
|
+
data.tar.gz: 8165e82eedbb4db9a39f4e9de1218d3621467ee8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5e94711f6a3b4b745220d04693a2e060247eaf4c593ee7be86e27a5dad7e9e5ab57197de8b33eec001bed49db11b3ff964d26bfaff6ffd9887d11182277da2fd
|
7
|
+
data.tar.gz: 66bae0fc232eda35804a056dbf1465293b4961780dbe5a052b75e2352ff93925ea6d54f781b50eb3ac6e87a91391ca740c8556163b12b4dc43b5536823e062fa
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,412 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-05-17 14:03:40 -0700 using RuboCop version 0.21.0.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 1
|
9
|
+
# Cop supports --auto-correct.
|
10
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
11
|
+
AccessModifierIndentation:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
# Offense count: 1
|
15
|
+
AccessorMethodName:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
# Offense count: 2
|
19
|
+
# Cop supports --auto-correct.
|
20
|
+
Alias:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
# Offense count: 1
|
24
|
+
# Cop supports --auto-correct.
|
25
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
26
|
+
AlignParameters:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# Offense count: 8
|
30
|
+
# Cop supports --auto-correct.
|
31
|
+
AndOr:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
# Offense count: 10
|
35
|
+
# Configuration parameters: AllowSafeAssignment.
|
36
|
+
AssignmentInCondition:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
# Offense count: 1
|
40
|
+
BlockNesting:
|
41
|
+
Max: 4
|
42
|
+
|
43
|
+
# Offense count: 3
|
44
|
+
# Cop supports --auto-correct.
|
45
|
+
Blocks:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
# Offense count: 4
|
49
|
+
CaseEquality:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
# Offense count: 2
|
53
|
+
# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep.
|
54
|
+
CaseIndentation:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
# Offense count: 1
|
58
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
59
|
+
ClassAndModuleChildren:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
# Offense count: 3
|
63
|
+
# Configuration parameters: CountComments.
|
64
|
+
ClassLength:
|
65
|
+
Max: 257
|
66
|
+
|
67
|
+
# Offense count: 6
|
68
|
+
# Cop supports --auto-correct.
|
69
|
+
# Configuration parameters: PreferredMethods.
|
70
|
+
CollectionMethods:
|
71
|
+
Enabled: false
|
72
|
+
|
73
|
+
# Offense count: 3
|
74
|
+
# Cop supports --auto-correct.
|
75
|
+
ColonMethodCall:
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
# Offense count: 1
|
79
|
+
# Configuration parameters: Keywords.
|
80
|
+
CommentAnnotation:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
# Offense count: 9
|
84
|
+
CyclomaticComplexity:
|
85
|
+
Max: 8
|
86
|
+
|
87
|
+
# Offense count: 1
|
88
|
+
# Cop supports --auto-correct.
|
89
|
+
DefWithParentheses:
|
90
|
+
Enabled: false
|
91
|
+
|
92
|
+
# Offense count: 1
|
93
|
+
# Cop supports --auto-correct.
|
94
|
+
DeprecatedHashMethods:
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
# Offense count: 75
|
98
|
+
Documentation:
|
99
|
+
Enabled: false
|
100
|
+
|
101
|
+
# Offense count: 4
|
102
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
103
|
+
DotPosition:
|
104
|
+
Enabled: false
|
105
|
+
|
106
|
+
# Offense count: 3
|
107
|
+
DoubleNegation:
|
108
|
+
Enabled: false
|
109
|
+
|
110
|
+
# Offense count: 10
|
111
|
+
# Cop supports --auto-correct.
|
112
|
+
# Configuration parameters: AllowAdjacentOneLineDefs.
|
113
|
+
EmptyLineBetweenDefs:
|
114
|
+
Enabled: false
|
115
|
+
|
116
|
+
# Offense count: 1
|
117
|
+
# Cop supports --auto-correct.
|
118
|
+
EmptyLines:
|
119
|
+
Enabled: false
|
120
|
+
|
121
|
+
Encoding:
|
122
|
+
Enabled: false
|
123
|
+
|
124
|
+
# Offense count: 1
|
125
|
+
# Configuration parameters: AlignWith, SupportedStyles.
|
126
|
+
EndAlignment:
|
127
|
+
Enabled: false
|
128
|
+
|
129
|
+
# Offense count: 2
|
130
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
131
|
+
For:
|
132
|
+
Enabled: false
|
133
|
+
|
134
|
+
# Offense count: 1
|
135
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
136
|
+
FormatString:
|
137
|
+
Enabled: false
|
138
|
+
|
139
|
+
# Offense count: 27
|
140
|
+
# Configuration parameters: AllowedVariables.
|
141
|
+
GlobalVars:
|
142
|
+
Enabled: false
|
143
|
+
|
144
|
+
# Offense count: 10
|
145
|
+
HandleExceptions:
|
146
|
+
Enabled: false
|
147
|
+
|
148
|
+
# Offense count: 42
|
149
|
+
# Cop supports --auto-correct.
|
150
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
151
|
+
HashSyntax:
|
152
|
+
Enabled: false
|
153
|
+
|
154
|
+
# Offense count: 6
|
155
|
+
# Configuration parameters: MaxLineLength.
|
156
|
+
IfUnlessModifier:
|
157
|
+
Enabled: false
|
158
|
+
|
159
|
+
# Offense count: 1
|
160
|
+
# Cop supports --auto-correct.
|
161
|
+
IndentationWidth:
|
162
|
+
Enabled: false
|
163
|
+
|
164
|
+
# Offense count: 4
|
165
|
+
Lambda:
|
166
|
+
Enabled: false
|
167
|
+
|
168
|
+
# Offense count: 2
|
169
|
+
# Cop supports --auto-correct.
|
170
|
+
LeadingCommentSpace:
|
171
|
+
Enabled: false
|
172
|
+
|
173
|
+
# Offense count: 149
|
174
|
+
LineLength:
|
175
|
+
Max: 176
|
176
|
+
|
177
|
+
# Offense count: 1
|
178
|
+
LiteralInCondition:
|
179
|
+
Enabled: false
|
180
|
+
|
181
|
+
# Offense count: 3
|
182
|
+
Loop:
|
183
|
+
Enabled: false
|
184
|
+
|
185
|
+
# Offense count: 1
|
186
|
+
# Cop supports --auto-correct.
|
187
|
+
MethodCallParentheses:
|
188
|
+
Enabled: false
|
189
|
+
|
190
|
+
# Offense count: 2
|
191
|
+
# Cop supports --auto-correct.
|
192
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
193
|
+
MethodDefParentheses:
|
194
|
+
Enabled: false
|
195
|
+
|
196
|
+
# Offense count: 42
|
197
|
+
# Configuration parameters: CountComments.
|
198
|
+
MethodLength:
|
199
|
+
Max: 82
|
200
|
+
|
201
|
+
# Offense count: 1
|
202
|
+
ModuleFunction:
|
203
|
+
Enabled: false
|
204
|
+
|
205
|
+
# Offense count: 1
|
206
|
+
# Cop supports --auto-correct.
|
207
|
+
NegatedWhile:
|
208
|
+
Enabled: false
|
209
|
+
|
210
|
+
# Offense count: 6
|
211
|
+
# Cop supports --auto-correct.
|
212
|
+
NilComparison:
|
213
|
+
Enabled: false
|
214
|
+
|
215
|
+
# Offense count: 2
|
216
|
+
# Cop supports --auto-correct.
|
217
|
+
NonNilCheck:
|
218
|
+
Enabled: false
|
219
|
+
|
220
|
+
# Offense count: 1
|
221
|
+
# Cop supports --auto-correct.
|
222
|
+
Not:
|
223
|
+
Enabled: false
|
224
|
+
|
225
|
+
# Offense count: 1
|
226
|
+
# Cop supports --auto-correct.
|
227
|
+
NumericLiterals:
|
228
|
+
MinDigits: 7
|
229
|
+
|
230
|
+
# Offense count: 1
|
231
|
+
# Configuration parameters: CountKeywordArgs.
|
232
|
+
ParameterLists:
|
233
|
+
Max: 6
|
234
|
+
|
235
|
+
# Offense count: 1
|
236
|
+
# Configuration parameters: NamePrefixBlacklist.
|
237
|
+
PredicateName:
|
238
|
+
Enabled: false
|
239
|
+
|
240
|
+
# Offense count: 2
|
241
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
242
|
+
RaiseArgs:
|
243
|
+
Enabled: false
|
244
|
+
|
245
|
+
# Offense count: 1
|
246
|
+
RedundantException:
|
247
|
+
Enabled: false
|
248
|
+
|
249
|
+
# Offense count: 1
|
250
|
+
# Cop supports --auto-correct.
|
251
|
+
# Configuration parameters: AllowMultipleReturnValues.
|
252
|
+
RedundantReturn:
|
253
|
+
Enabled: false
|
254
|
+
|
255
|
+
# Offense count: 2
|
256
|
+
# Cop supports --auto-correct.
|
257
|
+
RedundantSelf:
|
258
|
+
Enabled: false
|
259
|
+
|
260
|
+
# Offense count: 4
|
261
|
+
# Cop supports --auto-correct.
|
262
|
+
RescueException:
|
263
|
+
Enabled: false
|
264
|
+
|
265
|
+
# Offense count: 8
|
266
|
+
RescueModifier:
|
267
|
+
Enabled: false
|
268
|
+
|
269
|
+
# Offense count: 4
|
270
|
+
# Cop supports --auto-correct.
|
271
|
+
# Configuration parameters: AllowAsExpressionSeparator.
|
272
|
+
Semicolon:
|
273
|
+
Enabled: false
|
274
|
+
|
275
|
+
# Offense count: 70
|
276
|
+
# Cop supports --auto-correct.
|
277
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
278
|
+
SignalException:
|
279
|
+
Enabled: false
|
280
|
+
|
281
|
+
# Offense count: 2
|
282
|
+
# Configuration parameters: Methods.
|
283
|
+
SingleLineBlockParams:
|
284
|
+
Enabled: false
|
285
|
+
|
286
|
+
# Offense count: 28
|
287
|
+
# Cop supports --auto-correct.
|
288
|
+
# Configuration parameters: AllowIfMethodIsEmpty.
|
289
|
+
SingleLineMethods:
|
290
|
+
Enabled: false
|
291
|
+
|
292
|
+
# Offense count: 11
|
293
|
+
# Cop supports --auto-correct.
|
294
|
+
SingleSpaceBeforeFirstArg:
|
295
|
+
Enabled: false
|
296
|
+
|
297
|
+
# Offense count: 5
|
298
|
+
# Cop supports --auto-correct.
|
299
|
+
SpaceAfterComma:
|
300
|
+
Enabled: false
|
301
|
+
|
302
|
+
# Offense count: 7
|
303
|
+
# Cop supports --auto-correct.
|
304
|
+
SpaceAfterMethodName:
|
305
|
+
Enabled: false
|
306
|
+
|
307
|
+
# Offense count: 15
|
308
|
+
# Cop supports --auto-correct.
|
309
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
310
|
+
SpaceAroundEqualsInParameterDefault:
|
311
|
+
Enabled: false
|
312
|
+
|
313
|
+
# Offense count: 3
|
314
|
+
# Cop supports --auto-correct.
|
315
|
+
SpaceAroundOperators:
|
316
|
+
Enabled: false
|
317
|
+
|
318
|
+
# Offense count: 4
|
319
|
+
# Cop supports --auto-correct.
|
320
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
321
|
+
SpaceBeforeBlockBraces:
|
322
|
+
Enabled: false
|
323
|
+
|
324
|
+
# Offense count: 6
|
325
|
+
# Cop supports --auto-correct.
|
326
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
327
|
+
SpaceInsideBlockBraces:
|
328
|
+
Enabled: false
|
329
|
+
|
330
|
+
# Offense count: 2
|
331
|
+
# Cop supports --auto-correct.
|
332
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
|
333
|
+
SpaceInsideHashLiteralBraces:
|
334
|
+
Enabled: false
|
335
|
+
|
336
|
+
# Offense count: 1
|
337
|
+
# Cop supports --auto-correct.
|
338
|
+
SpaceInsideParens:
|
339
|
+
Enabled: false
|
340
|
+
|
341
|
+
# Offense count: 13
|
342
|
+
# Cop supports --auto-correct.
|
343
|
+
SpecialGlobalVars:
|
344
|
+
Enabled: false
|
345
|
+
|
346
|
+
# Offense count: 2
|
347
|
+
# Cop supports --auto-correct.
|
348
|
+
StringConversionInInterpolation:
|
349
|
+
Enabled: false
|
350
|
+
|
351
|
+
# Offense count: 423
|
352
|
+
# Cop supports --auto-correct.
|
353
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
354
|
+
StringLiterals:
|
355
|
+
Enabled: false
|
356
|
+
|
357
|
+
# Offense count: 3
|
358
|
+
# Cop supports --auto-correct.
|
359
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
360
|
+
TrailingBlankLines:
|
361
|
+
Enabled: false
|
362
|
+
|
363
|
+
# Offense count: 3
|
364
|
+
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
365
|
+
TrailingComma:
|
366
|
+
Enabled: false
|
367
|
+
|
368
|
+
# Offense count: 2
|
369
|
+
# Cop supports --auto-correct.
|
370
|
+
TrailingWhitespace:
|
371
|
+
Enabled: false
|
372
|
+
|
373
|
+
# Offense count: 17
|
374
|
+
# Cop supports --auto-correct.
|
375
|
+
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
|
376
|
+
TrivialAccessors:
|
377
|
+
Enabled: false
|
378
|
+
|
379
|
+
# Offense count: 4
|
380
|
+
UnderscorePrefixedVariableName:
|
381
|
+
Enabled: false
|
382
|
+
|
383
|
+
# Offense count: 3
|
384
|
+
UnusedBlockArgument:
|
385
|
+
Enabled: false
|
386
|
+
|
387
|
+
# Offense count: 9
|
388
|
+
UnusedMethodArgument:
|
389
|
+
Enabled: false
|
390
|
+
|
391
|
+
# Offense count: 7
|
392
|
+
UselessAssignment:
|
393
|
+
Enabled: false
|
394
|
+
|
395
|
+
# Offense count: 1
|
396
|
+
# Cop supports --auto-correct.
|
397
|
+
VariableInterpolation:
|
398
|
+
Enabled: false
|
399
|
+
|
400
|
+
# Offense count: 4
|
401
|
+
Void:
|
402
|
+
Enabled: false
|
403
|
+
|
404
|
+
# Offense count: 2
|
405
|
+
# Configuration parameters: MaxLineLength.
|
406
|
+
WhileUntilModifier:
|
407
|
+
Enabled: false
|
408
|
+
|
409
|
+
# Offense count: 1
|
410
|
+
# Cop supports --auto-correct.
|
411
|
+
WordArray:
|
412
|
+
MinSize: 2
|
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
script: rake ci
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.2.0
|
5
|
+
- jruby
|
6
|
+
- ruby-head
|
7
|
+
- jruby-head
|
8
|
+
- rbx-2
|
9
|
+
|
10
|
+
matrix:
|
11
|
+
allow_failures:
|
12
|
+
- rvm: rbx-2
|
13
|
+
- rvm: ruby-head
|
14
|
+
- rvm: jruby-head
|
15
|
+
|
16
|
+
notifications:
|
17
|
+
irc: "irc.freenode.org#celluloid"
|
18
|
+
|
19
|
+
sudo: false
|
20
|
+
install: bundle install --retry=3 --without=development
|
data/CHANGES.md
ADDED
File without changes
|
data/Gemfile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'coveralls', require: false
|
4
|
+
gemspec development_group: :gem_build_tools
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem 'pry'
|
8
|
+
#de gem 'guard'
|
9
|
+
#de gem 'rb-fsevent', '~> 0.9.1' if RUBY_PLATFORM =~ /darwin/
|
10
|
+
#de gem 'guard-rspec'
|
11
|
+
gem 'rubocop'
|
12
|
+
end
|
13
|
+
|
14
|
+
group :test do
|
15
|
+
gem 'dotenv', '~> 2.0'
|
16
|
+
gem 'nenv'
|
17
|
+
gem 'benchmark_suite'
|
18
|
+
gem 'rspec', '~> 3.2'
|
19
|
+
gem 'rspec-retry'
|
20
|
+
gem 'rspec-log_split', github: 'abstractive/rspec-log_split', branch: 'master'
|
21
|
+
# gem 'celluloid', github: 'celluloid/celluloid', branch: '0.17.0-prerelease'
|
22
|
+
end
|
23
|
+
|
24
|
+
group :gem_build_tools do
|
25
|
+
gem 'rake'
|
26
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Celluloid
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
celluloid-coordinator
|
2
|
+
=====================
|
3
|
+
|
4
|
+
This is an implementation of a work-dispatch system where the coordinator is decoupled from the workers.
|
5
|
+
It also allows for the router to be introduced to new workers and for old workers to be removed dynamically.
|
6
|
+
|
7
|
+
### Message flow
|
8
|
+
|
9
|
+
![Message flow](https://s3.amazonaws.com/f.cl.ly/items/3G1d1T1J1a2e2g2E2S1D/Coordinator%2BRouter%202.png "Message flow")
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = 'celluloid-coordinator'
|
5
|
+
gem.version = '0.0.1.pre0'
|
6
|
+
gem.platform = Gem::Platform::RUBY
|
7
|
+
gem.summary = "Celluloid's implementation of a work-dispatch system."
|
8
|
+
gem.description = 'A work-dispatch system where the coordinator is decoupled from the workers'
|
9
|
+
gem.licenses = ['MIT']
|
10
|
+
|
11
|
+
gem.authors = ["Tim Carey-Smith", "Tony Arcieri", "digitalextremist //"]
|
12
|
+
gem.email = ['tony.arcieri@gmail.com', 'code@extremist.digital']
|
13
|
+
gem.homepage = 'https://github.com/celluloid/celluloid-coordinator'
|
14
|
+
|
15
|
+
gem.required_ruby_version = '>= 1.9.2'
|
16
|
+
gem.required_rubygems_version = '>= 1.3.6'
|
17
|
+
|
18
|
+
gem.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|examples|spec|features)/}) }
|
19
|
+
gem.require_path = 'lib'
|
20
|
+
|
21
|
+
gem.add_development_dependency 'bundler'
|
22
|
+
gem.add_runtime_dependency 'celluloid', '>= 0.17.0.pre0'
|
23
|
+
gem.add_runtime_dependency 'celluloid-essentials', '>= 0.20.0.pre0'
|
24
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'celluloid' unless defined? Celluloid
|
2
|
+
|
3
|
+
module Celluloid
|
4
|
+
class Coordinator
|
5
|
+
include Celluloid
|
6
|
+
|
7
|
+
def initialize(destination)
|
8
|
+
@destination = destination
|
9
|
+
@backlog = []
|
10
|
+
@futures = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def enqueue(epic)
|
14
|
+
if @running
|
15
|
+
@backlog << epic
|
16
|
+
else
|
17
|
+
@current = epic.to_a
|
18
|
+
3.times do
|
19
|
+
async.dequeue
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def dequeue
|
25
|
+
if work = @current.shift
|
26
|
+
Celluloid::Internals::Logger.info "sending work: #{work.inspect}"
|
27
|
+
result = @destination.sync(:perform, work)
|
28
|
+
Celluloid::Internals::Logger.info "got result: #{result.inspect}"
|
29
|
+
async.dequeue
|
30
|
+
else
|
31
|
+
Celluloid::Internals::Logger.info "no more work"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Reiterator
|
37
|
+
def initialize(ary)
|
38
|
+
@iterator = ary.each
|
39
|
+
end
|
40
|
+
|
41
|
+
def next
|
42
|
+
@iterator.next
|
43
|
+
rescue StopIteration
|
44
|
+
@iterator.rewind
|
45
|
+
retry
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class Router
|
50
|
+
include Celluloid
|
51
|
+
|
52
|
+
def initialize(number, klass)
|
53
|
+
@children = number.times.map do
|
54
|
+
klass.new
|
55
|
+
end
|
56
|
+
@iterator = Reiterator.new(@children)
|
57
|
+
end
|
58
|
+
|
59
|
+
def method_missing(meth, *args, &block)
|
60
|
+
@iterator.next.sync(meth, *args, &block)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: celluloid-coordinator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.pre0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tim Carey-Smith
|
8
|
+
- Tony Arcieri
|
9
|
+
- digitalextremist //
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2015-04-19 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: celluloid
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.17.0.pre0
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.17.0.pre0
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: celluloid-essentials
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.20.0.pre0
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.20.0.pre0
|
57
|
+
description: A work-dispatch system where the coordinator is decoupled from the workers
|
58
|
+
email:
|
59
|
+
- tony.arcieri@gmail.com
|
60
|
+
- code@extremist.digital
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- ".gitignore"
|
66
|
+
- ".rspec"
|
67
|
+
- ".rubocop.yml"
|
68
|
+
- ".travis.yml"
|
69
|
+
- CHANGES.md
|
70
|
+
- Gemfile
|
71
|
+
- LICENSE
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- celluloid-coordinator.gemspec
|
75
|
+
- lib/celluloid/coordinator.rb
|
76
|
+
homepage: https://github.com/celluloid/celluloid-coordinator
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 1.9.2
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.3.6
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.4.6
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Celluloid's implementation of a work-dispatch system.
|
100
|
+
test_files: []
|