tribe 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +20 -9
- data/lib/tribe/version.rb +1 -1
- data/tribe.gemspec +1 -1
- metadata +31 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d2145c5577d357092be0414dc111783969e351f
|
4
|
+
data.tar.gz: d19e8a8dcfd6587dda45ee4e36b69c8acc860e3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 510323dc16919ba9a9e378215216279efd8ef21e27e47482c1140ab09ece81fb905b164fe85034d3b570c50c8cd82b332ea9f70beca4216656ad14eacf27d29f
|
7
|
+
data.tar.gz: b96e88eaf1acd19a792f88a454a62fbb80d844dba9a37dab96b5852270bc00285a22c3a7e4ae320e47f47ab204c458ad032ddfb4d8690793cb918a6dabc0423f
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.2.2
|
data/README.md
CHANGED
@@ -147,7 +147,7 @@ Non-blocking futures are asynchronous and use callbacks.
|
|
147
147
|
No waiting for a result is involved and the actor will continue to process other events.
|
148
148
|
|
149
149
|
class ActorA < Tribe::Actor
|
150
|
-
|
150
|
+
private
|
151
151
|
def on_start(event)
|
152
152
|
friend = registry['actor_b']
|
153
153
|
future = future!(friend, :compute, 10)
|
@@ -163,7 +163,7 @@ No waiting for a result is involved and the actor will continue to process other
|
|
163
163
|
end
|
164
164
|
|
165
165
|
class ActorB < Tribe::Actor
|
166
|
-
|
166
|
+
private
|
167
167
|
def on_shutdown(event)
|
168
168
|
puts "MyActor (#{identifier}) is shutting down."
|
169
169
|
end
|
@@ -193,7 +193,7 @@ Blocking futures are synchronous.
|
|
193
193
|
The actor won't process any other events until the future has a result.
|
194
194
|
|
195
195
|
class ActorA < Tribe::Actor
|
196
|
-
|
196
|
+
private
|
197
197
|
def on_start(event)
|
198
198
|
friend = registry['actor_b']
|
199
199
|
future = future!(friend, :compute, 10)
|
@@ -209,7 +209,7 @@ The actor won't process any other events until the future has a result.
|
|
209
209
|
end
|
210
210
|
|
211
211
|
class ActorB < Tribe::Actor
|
212
|
-
|
212
|
+
private
|
213
213
|
def on_compute(event)
|
214
214
|
return factorial(event.data)
|
215
215
|
end
|
@@ -236,7 +236,7 @@ Futures can be confgured to timeout after a specified number of seconds.
|
|
236
236
|
When a timeout occurs, the result of the future will be a ````Tribe::FutureTimeout```` exception.
|
237
237
|
|
238
238
|
class ActorA < Tribe::Actor
|
239
|
-
|
239
|
+
private
|
240
240
|
def on_start(event)
|
241
241
|
friend = registry['actor_b']
|
242
242
|
future = future!(friend, :compute, 10)
|
@@ -253,7 +253,7 @@ When a timeout occurs, the result of the future will be a ````Tribe::FutureTimeo
|
|
253
253
|
end
|
254
254
|
|
255
255
|
class ActorB < Tribe::Actor
|
256
|
-
|
256
|
+
private
|
257
257
|
def on_compute(event)
|
258
258
|
sleep(4) # Force a timeout.
|
259
259
|
return event.data * 2
|
@@ -404,7 +404,7 @@ It is common practice to log actor exceptions or print them to stdout.
|
|
404
404
|
This is easily accomplished with the ````on_exception```` handler in a base class:
|
405
405
|
|
406
406
|
class MyBaseActor < Tribe::Actor
|
407
|
-
|
407
|
+
private
|
408
408
|
def on_exception(event)
|
409
409
|
e = event.data[:exception]
|
410
410
|
puts "#{e.class.name}: #{e.message}:\n#{e.backtrace.join("\n")}"
|
@@ -441,7 +441,7 @@ Most modern operating systems can support many thousands of simultanous threads
|
|
441
441
|
To support in the tens of thousands, hundreds of thousands, or potentially millions of actors, you will need to use non-blocking actors.
|
442
442
|
|
443
443
|
class MyActor < Tribe::Actor
|
444
|
-
|
444
|
+
private
|
445
445
|
def on_start(event)
|
446
446
|
blocking! do
|
447
447
|
sleep 6
|
@@ -481,6 +481,17 @@ Every actor also has access to it through the ````logger```` convenience method.
|
|
481
481
|
This local instance of the logger is wrapped in a proxy for your convenience.
|
482
482
|
This way your code can assume the logger exists even if ````Tribe.logger```` is set to ````nil````.
|
483
483
|
|
484
|
+
class MyActor < Tribe::Actor
|
485
|
+
private
|
486
|
+
def on_initialize(event)
|
487
|
+
logger.debug("hello world.")
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
actor = MyActor.new
|
492
|
+
actor.perform! { raise 'uh oh' }
|
493
|
+
|
494
|
+
|
484
495
|
By default, the logger will log to STDOUT.
|
485
496
|
You should change this to a file in your application.
|
486
497
|
|
@@ -490,7 +501,7 @@ Tribe is written in pure Ruby so it will work with all existing debuggers that s
|
|
490
501
|
[Byebug] (https://github.com/deivid-rodriguez/byebug) is commonly used with MRI Ruby 2.X and will let you set breakpoints.
|
491
502
|
|
492
503
|
The most common problem you will encounter with actors is that they die due to exceptions.
|
493
|
-
You can access the exception
|
504
|
+
You can access the exception by calling the ````exception```` method on the actor:
|
494
505
|
|
495
506
|
actor = Tribe::Actor.new
|
496
507
|
actor.perform! { raise 'goodbye' }
|
data/lib/tribe/version.rb
CHANGED
data/tribe.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "workers", "~> 0.
|
21
|
+
spec.add_dependency "workers", "~> 0.6"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.10"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,81 +1,81 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tribe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Remesch
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: workers
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
|
-
- - ~>
|
17
|
+
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
|
-
version: '0.
|
19
|
-
name: workers
|
20
|
-
prerelease: false
|
19
|
+
version: '0.6'
|
21
20
|
type: :runtime
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- - ~>
|
31
|
+
- - "~>"
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '1.10'
|
33
|
-
name: bundler
|
34
|
-
prerelease: false
|
35
34
|
type: :development
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.10'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
|
-
- - ~>
|
45
|
+
- - "~>"
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '10.0'
|
47
|
-
name: rake
|
48
|
-
prerelease: false
|
49
48
|
type: :development
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
|
-
- -
|
59
|
+
- - ">="
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
61
|
-
name: minitest
|
62
|
-
prerelease: false
|
63
62
|
type: :development
|
63
|
+
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
description:
|
69
|
+
description:
|
70
70
|
email:
|
71
71
|
- chad@remesch.com
|
72
72
|
executables: []
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .ruby-version
|
78
|
-
- .travis.yml
|
76
|
+
- ".gitignore"
|
77
|
+
- ".ruby-version"
|
78
|
+
- ".travis.yml"
|
79
79
|
- Gemfile
|
80
80
|
- Gemfile.lock
|
81
81
|
- LICENSE
|
@@ -103,24 +103,24 @@ homepage: https://github.com/chadrem/tribe
|
|
103
103
|
licenses:
|
104
104
|
- MIT
|
105
105
|
metadata: {}
|
106
|
-
post_install_message:
|
106
|
+
post_install_message:
|
107
107
|
rdoc_options: []
|
108
108
|
require_paths:
|
109
109
|
- lib
|
110
110
|
required_ruby_version: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
|
-
- -
|
112
|
+
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
rubyforge_project:
|
122
|
-
rubygems_version: 2.4.
|
123
|
-
signing_key:
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.4.5
|
123
|
+
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Actors based concurrency library for Ruby.
|
126
126
|
test_files: []
|