celluloid-supervision 0.20.0 → 0.20.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23fdf38a81deae26b5dc2662f61121649736c0e2
4
- data.tar.gz: 853b6aa1d716a24fa41659446926413b9e24153c
3
+ metadata.gz: f62d1faacdaed9f8d51985b20263c17ba4363d59
4
+ data.tar.gz: 6b79a9a5ab4eb25bdf49c47723489a8d1259a0f5
5
5
  SHA512:
6
- metadata.gz: f064277afe5f405701058ae5a4a2db673be12aba830484aecae2777c01168d7db0f3768c9c92d2f94946f13d82d7abaea8879dd44a593eabc405ea6ec87867b0
7
- data.tar.gz: 2baa6fbf05a6836419bc08c710de9e4f1791dd16eccfbdf97fb0d4c78d8d230134184f8329ac5260846625fe0ce49b9a9fecca31a33f6c0c4014fc086c40f5d1
6
+ metadata.gz: 17b27060543bd2eff8a4498c1ac39bcbeafac54ae75246b83cac8101f9fa6fb073f4d024553c21cdff6735da2820dbe4a0c46c505fe01203d36f8afee149b506
7
+ data.tar.gz: f8dccac2e2c8db22deb98c39d66108b60fcdea649149c7107439711ec753ba82865f8f07c676b8bbfccaabe63484b013db3e4c42a299c1cb7c0278706eb66d70
data/CHANGES.md CHANGED
@@ -0,0 +1,12 @@
1
+ 0.20.1 (2015-08-06)
2
+ -----
3
+ * Fixed arity checking
4
+ * Added usage examples to README
5
+ * Change reference to `Actor::System` ( was `ActorSystem` )
6
+
7
+ 0.20.0 (2015-07-04)
8
+ -----
9
+ * Extracted from Celluloid
10
+ * Re-added Supervision Trees
11
+ * Added Configuration object
12
+ * Added injections and behaviors
data/README.md CHANGED
@@ -1 +1,102 @@
1
- Supervisors, Supervision Groups, and Supervision Trees for Celluloid.
1
+ ![Celluloid Supervision](https://raw.github.com/celluloid/celluloid-logos/master/celluloid-supervision/celluloid-supervision.png)
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/celluloid-supervision.svg)](http://rubygems.org/gems/celluloid-supervision)
4
+ [![Build Status](https://secure.travis-ci.org/celluloid/celluloid-supervision.svg?branch=master)](http://travis-ci.org/celluloid/celluloid-supervision)
5
+ [![Code Climate](https://codeclimate.com/github/celluloid/celluloid-supervision.svg)](https://codeclimate.com/github/celluloid/celluloid-supervision)
6
+ [![Coverage Status](https://coveralls.io/repos/celluloid/celluloid-supervision/badge.svg?branch=master)](https://coveralls.io/r/celluloid/celluloid-supervision)
7
+
8
+ Supervisors; with Supervision Containers (Groups), Configurations, and Trees for [Celluloid](https://github.com/celluloid/celluloid).
9
+
10
+
11
+ To supervise actors, you have many options:
12
+
13
+
14
+
15
+ # Using supervisors.
16
+
17
+ ### Directly
18
+
19
+ ```ruby
20
+ MyActor.supervise as: :my_actor # Without arguments.
21
+ MyActor.supervise as: :my_actor, args: [:one_arg, :two_args]
22
+ ```
23
+
24
+ ### Indirectly
25
+
26
+ ```ruby
27
+ Celluloid.supervise as: :my_actor, type: MyActor # Without arguments.
28
+ Celluloid.supervise as: :my_actor, type: MyActor, args: [:one_arg, :two_args]
29
+ ```
30
+
31
+
32
+ # Using containers.
33
+
34
+ ```ruby
35
+ container = Celluloid::Supervision::Container.new {
36
+ supervise type: MyActor, as: :my_actor
37
+ supervise type: MyActor, as: :my_actor_with_args, args: [:one_arg, :two_args]
38
+ }
39
+ container.run!
40
+ ```
41
+
42
+ # Using configuration objects:
43
+
44
+ ```ruby
45
+ config = Celluloid::Supervision::Configuration.define([
46
+ {
47
+ type: MyActor,
48
+ as: :my_actor
49
+ },
50
+ {
51
+ type: MyActor,
52
+ as: :my_actor_with_args,
53
+ args: [
54
+ :one_arg,
55
+ :two_args
56
+ ]
57
+ },
58
+ ])
59
+
60
+ # Whenever you would like to deploy the actors:
61
+ config.deploy
62
+
63
+ # Whenver you would like to shut them down:
64
+ config.shutdown
65
+
66
+ # Reuse the same configuration if you like!
67
+ config.deploy
68
+ ```
69
+
70
+ ### By on-going configuration object:
71
+
72
+ ```ruby
73
+ config = Celluloid::Supervision::Configuration.new
74
+ config.define type: MyActor, as: :my_actor
75
+ config.define type: MyActor, as: :my_actor_with_args, args: [:one_arg, :two_args]
76
+ config deploy
77
+
78
+ # Now add actors to the already running configuration.
79
+ config.add type: MyActor, as: :my_actor_deployed_immediately
80
+ config.shutdown
81
+ ```
82
+
83
+
84
+ # Documentation coming:
85
+
86
+ * Supervision Trees
87
+ * Supervised Pools
88
+ * Supervised Supervisors
89
+
90
+
91
+
92
+ ## Contributing
93
+
94
+ * Fork this repository on github.
95
+ * Make your changes and send us a pull request.
96
+ * If we like them we'll merge them.
97
+ * If we've accepted a patch, feel free to ask for commit access.
98
+
99
+ ## License
100
+
101
+ Copyright (c) 2011-2015 Tony Arcieri, Donovan Keme.
102
+ Distributed under the MIT License. See LICENSE.txt for further details.
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.description = "Supervisors, Supervision Groups, and Supervision Trees for Celluloid."
11
11
  gem.licenses = ["MIT"]
12
12
 
13
- gem.authors = ["digitalextremist //", "Tony Arcieri", "Tim Carey-Smith"]
13
+ gem.authors = ["Donovan Keme", "Tony Arcieri", "Tim Carey-Smith"]
14
14
  gem.email = ["code@extremist.digital", "tony.arcieri@gmail.com"]
15
15
  gem.homepage = "https://github.com/celluloid/"
16
16
 
@@ -164,7 +164,7 @@ module Celluloid
164
164
  end
165
165
 
166
166
  def invoke_injection(_point)
167
- # de puts "injection? #{point}"
167
+ #de puts "injection? #{point}"
168
168
  end
169
169
  end
170
170
  end
@@ -8,7 +8,7 @@ module Celluloid
8
8
  @state = :initializing # :ready
9
9
  resync_accessors
10
10
  @configuration = configuration
11
- define configuration if configuration.any?
11
+ define(configuration) if configuration.any?
12
12
  end
13
13
 
14
14
  def export
@@ -5,16 +5,16 @@ module Celluloid
5
5
  INSTANCE_RETRY_LIMIT = 5
6
6
 
7
7
  module Error
8
- class NoPublicService < StandardError; end
8
+ class NoPublicService < Celluloid::Error; end
9
9
  end
10
10
 
11
11
  class Configuration
12
12
  module Error
13
- class AlreadyDefined < StandardError; end
14
- class InvalidSupervisor < StandardError; end
15
- class InvalidValues < StandardError; end
16
- class Incomplete < StandardError; end
17
- class Invalid < StandardError; end
13
+ class AlreadyDefined < Celluloid::Error; end
14
+ class InvalidSupervisor < Celluloid::Error; end
15
+ class InvalidValues < Celluloid::Error; end
16
+ class Incomplete < Celluloid::Error; end
17
+ class Invalid < Celluloid::Error; end
18
18
  end
19
19
 
20
20
  # Using class variable so that parameters can be added by plugins.
@@ -6,7 +6,7 @@ module Celluloid
6
6
  @@behaviors = {} # Hash of identifying symbol parameter => Class
7
7
 
8
8
  module Error
9
- class Mutant < StandardError; end
9
+ class Mutant < Celluloid::Error; end
10
10
  end
11
11
 
12
12
  class << self
@@ -20,6 +20,7 @@ module Celluloid
20
20
  @branch = @configuration.fetch(:branch, @configuration[:as])
21
21
  @configuration.delete(Behavior.parameter(:supervise, @configuration))
22
22
  else
23
+ puts "#{@configuration[:supervise].class.name} ... #{@configuration[:supervise]}"
23
24
  fail ArgumentError.new("No actors given to Tree to supervise.")
24
25
  end
25
26
  end
@@ -34,14 +34,14 @@ module Celluloid
34
34
  @actor = @type.send(@method, *@args, &@block)
35
35
  @registry.add(@name, @actor, @branch) if @name
36
36
  invoke_injection(:after_start)
37
- rescue Celluloid::TimeoutError => ex
38
- Internals::Logger.error("TimeoutError at start of supervised instance of #{@type}")
37
+ rescue Celluloid::TaskTimeout => ex
38
+ Internals::Logger.error("TaskTimeout at start of supervised instance of #{@type}")
39
39
  raise ex
40
40
  # TODO: Implement timeout/retry.
41
41
  # unless ( @retry += 1 ) <= INSTANCE_RETRY_LIMIT
42
42
  # raise ex
43
43
  # end
44
- # Internals::Logger.warn("TimeoutError at start of supervised actor. Retrying in #{INSTANCE_RETRY_WAIT} seconds. ( Attempt #{@retry} of #{INSTANCE_RETRY_LIMIT} )")
44
+ # Internals::Logger.warn("TaskTimeout at start of supervised actor. Retrying in #{INSTANCE_RETRY_WAIT} seconds. ( Attempt #{@retry} of #{INSTANCE_RETRY_LIMIT} )")
45
45
  # sleep INSTANCE_RETRY_WAIT
46
46
  # retry
47
47
  rescue => ex
@@ -82,7 +82,7 @@ module Celluloid
82
82
  Celluloid.actor_system[actor]
83
83
  end
84
84
  end
85
- Celluloid::ActorSystem.instance_exec(@configuration[:as], name) do |actor, where|
85
+ Celluloid::Actor::System.instance_exec(@configuration[:as], name) do |actor, where|
86
86
  define_method(name) do
87
87
  Celluloid.actor_system[actor]
88
88
  end
@@ -97,7 +97,7 @@ module Celluloid
97
97
  Celluloid.instance_eval do
98
98
  remove_method(name) rescue nil # avoid warnings in tests
99
99
  end
100
- Celluloid::ActorSystem.instance_eval do
100
+ Celluloid::Actor::System.instance_eval do
101
101
  remove_method(name) rescue nil # avoid warnings in tests
102
102
  end
103
103
  end
@@ -2,10 +2,10 @@ module Celluloid
2
2
  module Supervision
3
3
  class Configuration
4
4
  class << self
5
- def valid?(configuration, fail=false)
5
+ def valid?(configuration, fails=false)
6
6
  parameters(:mandatory).each do |k|
7
7
  unless configuration.key? k
8
- if fail
8
+ if fails
9
9
  fail Error::Incomplete, "Missing `:#{k}` in supervision configuration."
10
10
  else
11
11
  return false
@@ -16,8 +16,8 @@ module Celluloid
16
16
  unless configuration[args].is_a? Proc
17
17
  __a = configuration[args] && configuration[args].count || 0
18
18
  __arity = configuration[klass].allocate.method(:initialize).arity
19
- unless __arity == -1 || __a == __arity
20
- if fail
19
+ unless (__arity < 0 && __a >= __arity.abs-1) || __a == __arity.abs
20
+ if fails
21
21
  fail ArgumentError.new("#{__a} vs. #{__arity}")
22
22
  else
23
23
  return false
@@ -1,5 +1,5 @@
1
1
  module Celluloid
2
2
  module Supervision
3
- VERSION = "0.20.0"
3
+ VERSION = "0.20.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celluloid-supervision
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
- - digitalextremist //
7
+ - Donovan Keme
8
8
  - Tony Arcieri
9
9
  - Tim Carey-Smith
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-07-04 00:00:00.000000000 Z
13
+ date: 2015-08-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  requirement: !ruby/object:Gem::Requirement
@@ -82,6 +82,20 @@ dependencies:
82
82
  - - '>='
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
+ - !ruby/object:Gem::Dependency
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ name: transpec
92
+ prerelease: false
93
+ type: :development
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
85
99
  - !ruby/object:Gem::Dependency
86
100
  requirement: !ruby/object:Gem::Requirement
87
101
  requirements:
@@ -313,7 +327,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
313
327
  version: 1.3.6
314
328
  requirements: []
315
329
  rubyforge_project:
316
- rubygems_version: 2.4.6
330
+ rubygems_version: 2.4.8
317
331
  signing_key:
318
332
  specification_version: 4
319
333
  summary: Celluloid Supervision