celluloid 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +25 -8
- data/lib/celluloid.rb +16 -7
- data/lib/celluloid.rbc +702 -0
- data/lib/celluloid/actor.rb +98 -32
- data/lib/celluloid/actor.rbc +4637 -0
- data/lib/celluloid/actor_proxy.rb +19 -3
- data/lib/celluloid/actor_proxy.rbc +1884 -0
- data/lib/celluloid/calls.rbc +1384 -0
- data/lib/celluloid/core_ext.rb +1 -1
- data/lib/celluloid/core_ext.rbc +255 -0
- data/lib/celluloid/events.rb +1 -1
- data/lib/celluloid/events.rbc +357 -0
- data/lib/celluloid/future.rbc +747 -0
- data/lib/celluloid/linking.rb +10 -0
- data/lib/celluloid/linking.rbc +1837 -0
- data/lib/celluloid/mailbox.rb +31 -37
- data/lib/celluloid/mailbox.rbc +1843 -0
- data/lib/celluloid/reference.rbc +128 -0
- data/lib/celluloid/registry.rbc +784 -0
- data/lib/celluloid/responses.rbc +344 -0
- data/lib/celluloid/supervisor.rbc +1032 -0
- data/lib/celluloid/tuple.rbc +459 -0
- data/lib/celluloid/version.rb +4 -0
- data/lib/celluloid/version.rbc +198 -0
- data/lib/celluloid/waker.rbc +0 -0
- metadata +36 -57
- data/.autotest +0 -14
- data/.document +0 -5
- data/.rspec +0 -3
- data/CHANGES.md +0 -8
- data/Gemfile +0 -13
- data/Gemfile.lock +0 -27
- data/LICENSE.txt +0 -20
- data/Rakefile +0 -51
- data/VERSION +0 -1
- data/celluloid.gemspec +0 -85
- data/lib/celluloid/waker.rb +0 -41
- data/spec/actor_spec.rb +0 -141
- data/spec/future_spec.rb +0 -20
- data/spec/mailbox_spec.rb +0 -50
- data/spec/registry_spec.rb +0 -22
- data/spec/spec_helper.rb +0 -9
- data/spec/supervisor_spec.rb +0 -94
- data/spec/waker_spec.rb +0 -34
data/README.md
CHANGED
@@ -13,6 +13,17 @@ things in the background while the caller carries on with its business.
|
|
13
13
|
These concurrent objects are called "actors". Actors are somewhere in between
|
14
14
|
the kind of object you're typically used to working with and a network service.
|
15
15
|
|
16
|
+
Supported Platforms
|
17
|
+
-------------------
|
18
|
+
|
19
|
+
Celluloid works on Ruby 1.9.2, JRuby 1.6 (in 1.9 mode), and Rubinius 2.0. JRuby
|
20
|
+
or Rubinius are the preferred platforms as they support true concurrent threads.
|
21
|
+
|
22
|
+
To use JRuby in 1.9 mode, you'll need to pass the "--1.9" command line option
|
23
|
+
to the JRuby executable, or set the "JRUBY_OPTS=--1.9" environment variable.
|
24
|
+
|
25
|
+
Celluloid works on Rubinius in either 1.8 or 1.9 mode.
|
26
|
+
|
16
27
|
Usage
|
17
28
|
-----
|
18
29
|
|
@@ -268,19 +279,25 @@ working, freshly-restarted version.
|
|
268
279
|
|
269
280
|
The main use of the registry is for interfacing with actors that are
|
270
281
|
automatically restarted by supervisors when they crash.
|
282
|
+
|
283
|
+
Logging
|
284
|
+
-------
|
285
|
+
|
286
|
+
By default, Celluloid will log any errors and backtraces from any crashing
|
287
|
+
actors to STDOUT. However, if you wish you can use any logger which is
|
288
|
+
compatible with the standard Ruby Logger API. For example, if you're using
|
289
|
+
Celluloid within a Rails application, you'll probably want to do:
|
290
|
+
|
291
|
+
Celluloid.logger = Rails.logger
|
271
292
|
|
272
293
|
Contributing to Celluloid
|
273
294
|
-------------------------
|
274
295
|
|
275
|
-
*
|
276
|
-
*
|
277
|
-
*
|
278
|
-
* Start a feature/bugfix branch
|
279
|
-
* Commit and push until you are happy with your contribution
|
280
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
281
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
296
|
+
* Fork Celluloid on github
|
297
|
+
* Make your changes and send me a pull request
|
298
|
+
* If I like them I'll merge them and give you commit access to my repository
|
282
299
|
|
283
300
|
Copyright
|
284
301
|
---------
|
285
302
|
|
286
|
-
Copyright (c) 2011 Tony Arcieri. See LICENSE.txt for further details.
|
303
|
+
Copyright (c) 2011 Tony Arcieri. See LICENSE.txt for further details.
|
data/lib/celluloid.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
|
2
|
-
VERSION = File.read File.expand_path('../../VERSION', __FILE__)
|
3
|
-
|
4
|
-
def self.version; VERSION; end
|
5
|
-
end
|
1
|
+
require 'logger'
|
6
2
|
|
3
|
+
require 'celluloid/version'
|
7
4
|
require 'celluloid/actor'
|
8
5
|
require 'celluloid/actor_proxy'
|
9
6
|
require 'celluloid/calls'
|
@@ -14,6 +11,18 @@ require 'celluloid/mailbox'
|
|
14
11
|
require 'celluloid/registry'
|
15
12
|
require 'celluloid/responses'
|
16
13
|
require 'celluloid/supervisor'
|
17
|
-
require 'celluloid/waker'
|
18
14
|
|
19
|
-
require 'celluloid/future'
|
15
|
+
require 'celluloid/future'
|
16
|
+
|
17
|
+
module Celluloid
|
18
|
+
@@logger_lock = Mutex.new
|
19
|
+
@@logger = Logger.new STDERR
|
20
|
+
|
21
|
+
def self.logger
|
22
|
+
@@logger_lock.synchronize { @@logger }
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.logger=(logger)
|
26
|
+
@@logger_lock.synchronize { @@logger = logger }
|
27
|
+
end
|
28
|
+
end
|
data/lib/celluloid.rbc
ADDED
@@ -0,0 +1,702 @@
|
|
1
|
+
!RBIX
|
2
|
+
3578385345186687227
|
3
|
+
18
|
4
|
+
M
|
5
|
+
1
|
6
|
+
n
|
7
|
+
n
|
8
|
+
x
|
9
|
+
10
|
10
|
+
__script__
|
11
|
+
i
|
12
|
+
145
|
13
|
+
5
|
14
|
+
7
|
15
|
+
0
|
16
|
+
64
|
17
|
+
47
|
18
|
+
49
|
19
|
+
1
|
20
|
+
1
|
21
|
+
15
|
22
|
+
5
|
23
|
+
7
|
24
|
+
2
|
25
|
+
64
|
26
|
+
47
|
27
|
+
49
|
28
|
+
1
|
29
|
+
1
|
30
|
+
15
|
31
|
+
5
|
32
|
+
7
|
33
|
+
3
|
34
|
+
64
|
35
|
+
47
|
36
|
+
49
|
37
|
+
1
|
38
|
+
1
|
39
|
+
15
|
40
|
+
5
|
41
|
+
7
|
42
|
+
4
|
43
|
+
64
|
44
|
+
47
|
45
|
+
49
|
46
|
+
1
|
47
|
+
1
|
48
|
+
15
|
49
|
+
5
|
50
|
+
7
|
51
|
+
5
|
52
|
+
64
|
53
|
+
47
|
54
|
+
49
|
55
|
+
1
|
56
|
+
1
|
57
|
+
15
|
58
|
+
5
|
59
|
+
7
|
60
|
+
6
|
61
|
+
64
|
62
|
+
47
|
63
|
+
49
|
64
|
+
1
|
65
|
+
1
|
66
|
+
15
|
67
|
+
5
|
68
|
+
7
|
69
|
+
7
|
70
|
+
64
|
71
|
+
47
|
72
|
+
49
|
73
|
+
1
|
74
|
+
1
|
75
|
+
15
|
76
|
+
5
|
77
|
+
7
|
78
|
+
8
|
79
|
+
64
|
80
|
+
47
|
81
|
+
49
|
82
|
+
1
|
83
|
+
1
|
84
|
+
15
|
85
|
+
5
|
86
|
+
7
|
87
|
+
9
|
88
|
+
64
|
89
|
+
47
|
90
|
+
49
|
91
|
+
1
|
92
|
+
1
|
93
|
+
15
|
94
|
+
5
|
95
|
+
7
|
96
|
+
10
|
97
|
+
64
|
98
|
+
47
|
99
|
+
49
|
100
|
+
1
|
101
|
+
1
|
102
|
+
15
|
103
|
+
5
|
104
|
+
7
|
105
|
+
11
|
106
|
+
64
|
107
|
+
47
|
108
|
+
49
|
109
|
+
1
|
110
|
+
1
|
111
|
+
15
|
112
|
+
5
|
113
|
+
7
|
114
|
+
12
|
115
|
+
64
|
116
|
+
47
|
117
|
+
49
|
118
|
+
1
|
119
|
+
1
|
120
|
+
15
|
121
|
+
5
|
122
|
+
7
|
123
|
+
13
|
124
|
+
64
|
125
|
+
47
|
126
|
+
49
|
127
|
+
1
|
128
|
+
1
|
129
|
+
15
|
130
|
+
99
|
131
|
+
7
|
132
|
+
14
|
133
|
+
65
|
134
|
+
49
|
135
|
+
15
|
136
|
+
2
|
137
|
+
13
|
138
|
+
99
|
139
|
+
12
|
140
|
+
7
|
141
|
+
16
|
142
|
+
12
|
143
|
+
7
|
144
|
+
17
|
145
|
+
12
|
146
|
+
65
|
147
|
+
12
|
148
|
+
49
|
149
|
+
18
|
150
|
+
4
|
151
|
+
15
|
152
|
+
49
|
153
|
+
16
|
154
|
+
0
|
155
|
+
15
|
156
|
+
2
|
157
|
+
11
|
158
|
+
I
|
159
|
+
6
|
160
|
+
I
|
161
|
+
0
|
162
|
+
I
|
163
|
+
0
|
164
|
+
I
|
165
|
+
0
|
166
|
+
I
|
167
|
+
0
|
168
|
+
n
|
169
|
+
p
|
170
|
+
19
|
171
|
+
s
|
172
|
+
6
|
173
|
+
logger
|
174
|
+
x
|
175
|
+
7
|
176
|
+
require
|
177
|
+
s
|
178
|
+
17
|
179
|
+
celluloid/version
|
180
|
+
s
|
181
|
+
15
|
182
|
+
celluloid/actor
|
183
|
+
s
|
184
|
+
21
|
185
|
+
celluloid/actor_proxy
|
186
|
+
s
|
187
|
+
15
|
188
|
+
celluloid/calls
|
189
|
+
s
|
190
|
+
18
|
191
|
+
celluloid/core_ext
|
192
|
+
s
|
193
|
+
16
|
194
|
+
celluloid/events
|
195
|
+
s
|
196
|
+
17
|
197
|
+
celluloid/linking
|
198
|
+
s
|
199
|
+
17
|
200
|
+
celluloid/mailbox
|
201
|
+
s
|
202
|
+
18
|
203
|
+
celluloid/registry
|
204
|
+
s
|
205
|
+
19
|
206
|
+
celluloid/responses
|
207
|
+
s
|
208
|
+
20
|
209
|
+
celluloid/supervisor
|
210
|
+
s
|
211
|
+
16
|
212
|
+
celluloid/future
|
213
|
+
x
|
214
|
+
9
|
215
|
+
Celluloid
|
216
|
+
x
|
217
|
+
11
|
218
|
+
open_module
|
219
|
+
x
|
220
|
+
15
|
221
|
+
__module_init__
|
222
|
+
M
|
223
|
+
1
|
224
|
+
n
|
225
|
+
n
|
226
|
+
x
|
227
|
+
9
|
228
|
+
Celluloid
|
229
|
+
i
|
230
|
+
92
|
231
|
+
5
|
232
|
+
66
|
233
|
+
5
|
234
|
+
7
|
235
|
+
0
|
236
|
+
45
|
237
|
+
1
|
238
|
+
2
|
239
|
+
13
|
240
|
+
71
|
241
|
+
3
|
242
|
+
47
|
243
|
+
9
|
244
|
+
26
|
245
|
+
47
|
246
|
+
49
|
247
|
+
4
|
248
|
+
0
|
249
|
+
13
|
250
|
+
47
|
251
|
+
49
|
252
|
+
5
|
253
|
+
0
|
254
|
+
15
|
255
|
+
8
|
256
|
+
29
|
257
|
+
49
|
258
|
+
3
|
259
|
+
0
|
260
|
+
49
|
261
|
+
6
|
262
|
+
2
|
263
|
+
15
|
264
|
+
5
|
265
|
+
7
|
266
|
+
7
|
267
|
+
45
|
268
|
+
8
|
269
|
+
9
|
270
|
+
13
|
271
|
+
71
|
272
|
+
3
|
273
|
+
47
|
274
|
+
9
|
275
|
+
60
|
276
|
+
47
|
277
|
+
49
|
278
|
+
4
|
279
|
+
0
|
280
|
+
13
|
281
|
+
45
|
282
|
+
10
|
283
|
+
11
|
284
|
+
47
|
285
|
+
49
|
286
|
+
5
|
287
|
+
1
|
288
|
+
15
|
289
|
+
8
|
290
|
+
66
|
291
|
+
45
|
292
|
+
10
|
293
|
+
12
|
294
|
+
49
|
295
|
+
3
|
296
|
+
1
|
297
|
+
49
|
298
|
+
6
|
299
|
+
2
|
300
|
+
15
|
301
|
+
99
|
302
|
+
7
|
303
|
+
13
|
304
|
+
7
|
305
|
+
14
|
306
|
+
65
|
307
|
+
5
|
308
|
+
49
|
309
|
+
15
|
310
|
+
4
|
311
|
+
15
|
312
|
+
99
|
313
|
+
7
|
314
|
+
16
|
315
|
+
7
|
316
|
+
17
|
317
|
+
65
|
318
|
+
5
|
319
|
+
49
|
320
|
+
15
|
321
|
+
4
|
322
|
+
11
|
323
|
+
I
|
324
|
+
5
|
325
|
+
I
|
326
|
+
0
|
327
|
+
I
|
328
|
+
0
|
329
|
+
I
|
330
|
+
0
|
331
|
+
I
|
332
|
+
0
|
333
|
+
n
|
334
|
+
p
|
335
|
+
18
|
336
|
+
x
|
337
|
+
13
|
338
|
+
@@logger_lock
|
339
|
+
x
|
340
|
+
5
|
341
|
+
Mutex
|
342
|
+
n
|
343
|
+
x
|
344
|
+
3
|
345
|
+
new
|
346
|
+
x
|
347
|
+
8
|
348
|
+
allocate
|
349
|
+
x
|
350
|
+
10
|
351
|
+
initialize
|
352
|
+
x
|
353
|
+
18
|
354
|
+
class_variable_set
|
355
|
+
x
|
356
|
+
8
|
357
|
+
@@logger
|
358
|
+
x
|
359
|
+
6
|
360
|
+
Logger
|
361
|
+
n
|
362
|
+
x
|
363
|
+
6
|
364
|
+
STDERR
|
365
|
+
n
|
366
|
+
n
|
367
|
+
x
|
368
|
+
6
|
369
|
+
logger
|
370
|
+
M
|
371
|
+
1
|
372
|
+
n
|
373
|
+
n
|
374
|
+
x
|
375
|
+
6
|
376
|
+
logger
|
377
|
+
i
|
378
|
+
12
|
379
|
+
65
|
380
|
+
7
|
381
|
+
0
|
382
|
+
49
|
383
|
+
1
|
384
|
+
1
|
385
|
+
56
|
386
|
+
2
|
387
|
+
50
|
388
|
+
3
|
389
|
+
0
|
390
|
+
11
|
391
|
+
I
|
392
|
+
2
|
393
|
+
I
|
394
|
+
0
|
395
|
+
I
|
396
|
+
0
|
397
|
+
I
|
398
|
+
0
|
399
|
+
I
|
400
|
+
0
|
401
|
+
n
|
402
|
+
p
|
403
|
+
4
|
404
|
+
x
|
405
|
+
13
|
406
|
+
@@logger_lock
|
407
|
+
x
|
408
|
+
18
|
409
|
+
class_variable_get
|
410
|
+
M
|
411
|
+
1
|
412
|
+
p
|
413
|
+
2
|
414
|
+
x
|
415
|
+
9
|
416
|
+
for_block
|
417
|
+
t
|
418
|
+
n
|
419
|
+
x
|
420
|
+
6
|
421
|
+
logger
|
422
|
+
i
|
423
|
+
7
|
424
|
+
65
|
425
|
+
7
|
426
|
+
0
|
427
|
+
49
|
428
|
+
1
|
429
|
+
1
|
430
|
+
11
|
431
|
+
I
|
432
|
+
3
|
433
|
+
I
|
434
|
+
0
|
435
|
+
I
|
436
|
+
0
|
437
|
+
I
|
438
|
+
0
|
439
|
+
I
|
440
|
+
0
|
441
|
+
I
|
442
|
+
-2
|
443
|
+
p
|
444
|
+
2
|
445
|
+
x
|
446
|
+
8
|
447
|
+
@@logger
|
448
|
+
x
|
449
|
+
18
|
450
|
+
class_variable_get
|
451
|
+
p
|
452
|
+
3
|
453
|
+
I
|
454
|
+
0
|
455
|
+
I
|
456
|
+
16
|
457
|
+
I
|
458
|
+
7
|
459
|
+
x
|
460
|
+
42
|
461
|
+
/Users/tony/src/celluloid/lib/celluloid.rb
|
462
|
+
p
|
463
|
+
0
|
464
|
+
x
|
465
|
+
11
|
466
|
+
synchronize
|
467
|
+
p
|
468
|
+
5
|
469
|
+
I
|
470
|
+
-1
|
471
|
+
I
|
472
|
+
15
|
473
|
+
I
|
474
|
+
0
|
475
|
+
I
|
476
|
+
16
|
477
|
+
I
|
478
|
+
c
|
479
|
+
x
|
480
|
+
42
|
481
|
+
/Users/tony/src/celluloid/lib/celluloid.rb
|
482
|
+
p
|
483
|
+
0
|
484
|
+
x
|
485
|
+
13
|
486
|
+
attach_method
|
487
|
+
x
|
488
|
+
7
|
489
|
+
logger=
|
490
|
+
M
|
491
|
+
1
|
492
|
+
n
|
493
|
+
n
|
494
|
+
x
|
495
|
+
7
|
496
|
+
logger=
|
497
|
+
i
|
498
|
+
12
|
499
|
+
65
|
500
|
+
7
|
501
|
+
0
|
502
|
+
49
|
503
|
+
1
|
504
|
+
1
|
505
|
+
56
|
506
|
+
2
|
507
|
+
50
|
508
|
+
3
|
509
|
+
0
|
510
|
+
11
|
511
|
+
I
|
512
|
+
3
|
513
|
+
I
|
514
|
+
1
|
515
|
+
I
|
516
|
+
1
|
517
|
+
I
|
518
|
+
0
|
519
|
+
I
|
520
|
+
1
|
521
|
+
n
|
522
|
+
p
|
523
|
+
4
|
524
|
+
x
|
525
|
+
13
|
526
|
+
@@logger_lock
|
527
|
+
x
|
528
|
+
18
|
529
|
+
class_variable_get
|
530
|
+
M
|
531
|
+
1
|
532
|
+
p
|
533
|
+
2
|
534
|
+
x
|
535
|
+
9
|
536
|
+
for_block
|
537
|
+
t
|
538
|
+
n
|
539
|
+
x
|
540
|
+
7
|
541
|
+
logger=
|
542
|
+
i
|
543
|
+
10
|
544
|
+
65
|
545
|
+
7
|
546
|
+
0
|
547
|
+
21
|
548
|
+
1
|
549
|
+
0
|
550
|
+
49
|
551
|
+
1
|
552
|
+
2
|
553
|
+
11
|
554
|
+
I
|
555
|
+
4
|
556
|
+
I
|
557
|
+
0
|
558
|
+
I
|
559
|
+
0
|
560
|
+
I
|
561
|
+
0
|
562
|
+
I
|
563
|
+
0
|
564
|
+
I
|
565
|
+
-2
|
566
|
+
p
|
567
|
+
2
|
568
|
+
x
|
569
|
+
8
|
570
|
+
@@logger
|
571
|
+
x
|
572
|
+
18
|
573
|
+
class_variable_set
|
574
|
+
p
|
575
|
+
3
|
576
|
+
I
|
577
|
+
0
|
578
|
+
I
|
579
|
+
1a
|
580
|
+
I
|
581
|
+
a
|
582
|
+
x
|
583
|
+
42
|
584
|
+
/Users/tony/src/celluloid/lib/celluloid.rb
|
585
|
+
p
|
586
|
+
0
|
587
|
+
x
|
588
|
+
11
|
589
|
+
synchronize
|
590
|
+
p
|
591
|
+
5
|
592
|
+
I
|
593
|
+
-1
|
594
|
+
I
|
595
|
+
19
|
596
|
+
I
|
597
|
+
0
|
598
|
+
I
|
599
|
+
1a
|
600
|
+
I
|
601
|
+
c
|
602
|
+
x
|
603
|
+
42
|
604
|
+
/Users/tony/src/celluloid/lib/celluloid.rb
|
605
|
+
p
|
606
|
+
1
|
607
|
+
x
|
608
|
+
6
|
609
|
+
logger
|
610
|
+
p
|
611
|
+
9
|
612
|
+
I
|
613
|
+
2
|
614
|
+
I
|
615
|
+
12
|
616
|
+
I
|
617
|
+
21
|
618
|
+
I
|
619
|
+
13
|
620
|
+
I
|
621
|
+
46
|
622
|
+
I
|
623
|
+
15
|
624
|
+
I
|
625
|
+
51
|
626
|
+
I
|
627
|
+
19
|
628
|
+
I
|
629
|
+
5c
|
630
|
+
x
|
631
|
+
42
|
632
|
+
/Users/tony/src/celluloid/lib/celluloid.rb
|
633
|
+
p
|
634
|
+
0
|
635
|
+
x
|
636
|
+
13
|
637
|
+
attach_method
|
638
|
+
p
|
639
|
+
29
|
640
|
+
I
|
641
|
+
0
|
642
|
+
I
|
643
|
+
1
|
644
|
+
I
|
645
|
+
9
|
646
|
+
I
|
647
|
+
3
|
648
|
+
I
|
649
|
+
12
|
650
|
+
I
|
651
|
+
4
|
652
|
+
I
|
653
|
+
1b
|
654
|
+
I
|
655
|
+
5
|
656
|
+
I
|
657
|
+
24
|
658
|
+
I
|
659
|
+
6
|
660
|
+
I
|
661
|
+
2d
|
662
|
+
I
|
663
|
+
7
|
664
|
+
I
|
665
|
+
36
|
666
|
+
I
|
667
|
+
8
|
668
|
+
I
|
669
|
+
3f
|
670
|
+
I
|
671
|
+
9
|
672
|
+
I
|
673
|
+
48
|
674
|
+
I
|
675
|
+
a
|
676
|
+
I
|
677
|
+
51
|
678
|
+
I
|
679
|
+
b
|
680
|
+
I
|
681
|
+
5a
|
682
|
+
I
|
683
|
+
c
|
684
|
+
I
|
685
|
+
63
|
686
|
+
I
|
687
|
+
d
|
688
|
+
I
|
689
|
+
6c
|
690
|
+
I
|
691
|
+
f
|
692
|
+
I
|
693
|
+
75
|
694
|
+
I
|
695
|
+
11
|
696
|
+
I
|
697
|
+
91
|
698
|
+
x
|
699
|
+
42
|
700
|
+
/Users/tony/src/celluloid/lib/celluloid.rb
|
701
|
+
p
|
702
|
+
0
|