celluloid 0.18.0.pre → 0.18.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 +5 -5
- data/CHANGES.md +258 -39
- data/CONDUCT.md +13 -0
- data/CONTRIBUTING.md +39 -0
- data/README.md +54 -165
- data/REFACTOR.md +1 -0
- data/architecture.md +120 -0
- data/examples/basic_usage.rb +1 -1
- data/examples/configurations.rb +78 -0
- data/examples/futures.rb +1 -1
- data/examples/ring.rb +5 -4
- data/examples/simple_pmap.rb +1 -1
- data/examples/stack.rb +2 -2
- data/examples/supervisors_and_registry.rb +82 -0
- data/examples/timers.rb +2 -2
- data/lib/celluloid.rb +72 -47
- data/lib/celluloid/actor.rb +27 -17
- data/lib/celluloid/actor/system.rb +13 -29
- data/lib/celluloid/autostart.rb +5 -5
- data/lib/celluloid/call/async.rb +2 -0
- data/lib/celluloid/call/sync.rb +10 -3
- data/lib/celluloid/calls.rb +5 -12
- data/lib/celluloid/cell.rb +5 -9
- data/lib/celluloid/condition.rb +3 -3
- data/lib/celluloid/core_ext.rb +0 -2
- data/lib/celluloid/debug.rb +3 -0
- data/lib/celluloid/exceptions.rb +2 -2
- data/lib/celluloid/future.rb +7 -9
- data/lib/celluloid/group.rb +12 -8
- data/lib/celluloid/group/pool.rb +1 -3
- data/lib/celluloid/group/spawner.rb +2 -6
- data/lib/celluloid/internals/call_chain.rb +15 -0
- data/lib/celluloid/internals/cpu_counter.rb +62 -0
- data/lib/celluloid/internals/handlers.rb +42 -0
- data/lib/celluloid/internals/links.rb +38 -0
- data/lib/celluloid/internals/logger.rb +104 -0
- data/lib/celluloid/internals/method.rb +34 -0
- data/lib/celluloid/internals/properties.rb +32 -0
- data/lib/celluloid/internals/receivers.rb +64 -0
- data/lib/celluloid/internals/registry.rb +102 -0
- data/lib/celluloid/internals/responses.rb +46 -0
- data/lib/celluloid/internals/signals.rb +24 -0
- data/lib/celluloid/internals/stack.rb +74 -0
- data/lib/celluloid/internals/stack/dump.rb +12 -0
- data/lib/celluloid/internals/stack/states.rb +72 -0
- data/lib/celluloid/internals/stack/summary.rb +12 -0
- data/lib/celluloid/internals/task_set.rb +51 -0
- data/lib/celluloid/internals/thread_handle.rb +52 -0
- data/lib/celluloid/internals/uuid.rb +40 -0
- data/lib/celluloid/logging/incident.rb +21 -0
- data/lib/celluloid/logging/incident_logger.rb +147 -0
- data/lib/celluloid/logging/incident_reporter.rb +49 -0
- data/lib/celluloid/logging/log_event.rb +20 -0
- data/lib/celluloid/logging/ring_buffer.rb +64 -0
- data/lib/celluloid/mailbox.rb +22 -9
- data/lib/celluloid/mailbox/evented.rb +13 -5
- data/lib/celluloid/notifications.rb +95 -0
- data/lib/celluloid/pool.rb +6 -0
- data/lib/celluloid/probe.rb +81 -0
- data/lib/celluloid/proxy/abstract.rb +9 -9
- data/lib/celluloid/proxy/async.rb +1 -1
- data/lib/celluloid/proxy/block.rb +2 -2
- data/lib/celluloid/proxy/cell.rb +1 -1
- data/lib/celluloid/proxy/future.rb +2 -4
- data/lib/celluloid/proxy/sync.rb +1 -3
- data/lib/celluloid/rspec.rb +22 -33
- data/lib/celluloid/supervision.rb +17 -0
- data/lib/celluloid/supervision/configuration.rb +169 -0
- data/lib/celluloid/supervision/configuration/injections.rb +8 -0
- data/lib/celluloid/supervision/configuration/instance.rb +113 -0
- data/lib/celluloid/supervision/constants.rb +123 -0
- data/lib/celluloid/supervision/container.rb +144 -0
- data/lib/celluloid/supervision/container/behavior.rb +89 -0
- data/lib/celluloid/supervision/container/behavior/pool.rb +71 -0
- data/lib/celluloid/supervision/container/behavior/tree.rb +23 -0
- data/lib/celluloid/supervision/container/injections.rb +8 -0
- data/lib/celluloid/supervision/container/instance.rb +116 -0
- data/lib/celluloid/supervision/container/pool.rb +210 -0
- data/lib/celluloid/supervision/service.rb +27 -0
- data/lib/celluloid/supervision/supervise.rb +34 -0
- data/lib/celluloid/supervision/validation.rb +40 -0
- data/lib/celluloid/supervision/version.rb +5 -0
- data/lib/celluloid/system_events.rb +11 -6
- data/lib/celluloid/task.rb +25 -12
- data/lib/celluloid/task/fibered.rb +2 -0
- data/lib/celluloid/task/threaded.rb +3 -3
- data/lib/celluloid/test.rb +5 -2
- data/lib/celluloid/thread.rb +0 -2
- data/lib/celluloid/version.rb +1 -1
- data/spec/celluloid/block_spec.rb +29 -32
- data/spec/celluloid/calls_spec.rb +5 -15
- data/spec/celluloid/future_spec.rb +2 -2
- data/spec/celluloid/internals/cpu_counter_spec.rb +129 -0
- data/spec/celluloid/internals/links_spec.rb +43 -0
- data/spec/celluloid/internals/properties_spec.rb +40 -0
- data/spec/celluloid/internals/registry_spec.rb +62 -0
- data/spec/celluloid/internals/stack/dump_spec.rb +4 -0
- data/spec/celluloid/internals/stack/summary_spec.rb +4 -0
- data/spec/celluloid/internals/thread_handle_spec.rb +60 -0
- data/spec/celluloid/internals/uuid_spec.rb +9 -0
- data/spec/celluloid/logging/ring_buffer_spec.rb +36 -0
- data/spec/celluloid/mailbox/evented_spec.rb +11 -22
- data/spec/celluloid/misc/leak_spec.rb +3 -4
- data/spec/celluloid/notifications_spec.rb +140 -0
- data/spec/celluloid/probe_spec.rb +102 -0
- data/spec/celluloid/proxy_spec.rb +30 -30
- data/spec/celluloid/supervision/behavior_spec.rb +74 -0
- data/spec/celluloid/supervision/configuration_spec.rb +181 -0
- data/spec/celluloid/supervision/container_spec.rb +72 -0
- data/spec/celluloid/supervision/instance_spec.rb +13 -0
- data/spec/celluloid/supervision/root_spec.rb +28 -0
- data/spec/celluloid/supervision/supervisor_spec.rb +93 -0
- data/spec/celluloid/task/fibered_spec.rb +1 -3
- data/spec/celluloid/task/threaded_spec.rb +1 -3
- data/spec/shared/actor_examples.rb +58 -33
- data/spec/shared/group_examples.rb +2 -2
- data/spec/shared/mailbox_examples.rb +1 -1
- data/spec/shared/stack_examples.rb +87 -0
- data/spec/shared/task_examples.rb +2 -3
- data/spec/spec_helper.rb +2 -4
- data/spec/support/configure_rspec.rb +2 -3
- data/spec/support/coverage.rb +2 -4
- data/spec/support/crash_checking.rb +2 -2
- data/spec/support/examples/actor_class.rb +3 -8
- data/spec/support/examples/call_class.rb +2 -2
- data/spec/support/examples/container_class.rb +35 -0
- data/spec/support/examples/evented_mailbox_class.rb +1 -2
- data/spec/support/examples/stack_classes.rb +58 -0
- data/spec/support/examples/stack_methods.rb +23 -0
- data/spec/support/examples/subordinate_class.rb +19 -0
- data/spec/support/logging.rb +2 -34
- data/spec/support/loose_threads.rb +3 -16
- data/spec/support/reset_class_variables.rb +5 -1
- data/spec/support/stubbing.rb +1 -1
- metadata +91 -323
- data/culture/CONDUCT.md +0 -38
- data/culture/GSoC/1010-why_we_will_participate.md +0 -17
- data/culture/GSoC/1020-how_mentors_stay_engaged.md +0 -7
- data/culture/GSoC/1030-keeping_students_on_schedule.md +0 -9
- data/culture/GSoC/1040-getting_students_involved.md +0 -5
- data/culture/GSoC/1050-student_involvement_after.md +0 -5
- data/culture/GSoC/README.md +0 -16
- data/culture/Gemfile +0 -9
- data/culture/LICENSE.txt +0 -22
- data/culture/README.md +0 -22
- data/culture/Rakefile +0 -5
- data/culture/SYNC.md +0 -70
- data/culture/celluloid-culture.gemspec +0 -18
- data/culture/gems/README.md +0 -39
- data/culture/gems/dependencies.yml +0 -93
- data/culture/gems/loader.rb +0 -101
- data/culture/rubocop/README.md +0 -38
- data/culture/rubocop/lint.yml +0 -8
- data/culture/rubocop/metrics.yml +0 -15
- data/culture/rubocop/perf.yml +0 -0
- data/culture/rubocop/rubocop.yml +0 -5
- data/culture/rubocop/style.yml +0 -61
- data/culture/spec/gems_spec.rb +0 -2
- data/culture/spec/spec_helper.rb +0 -0
- data/culture/spec/sync_spec.rb +0 -2
- data/culture/sync.rb +0 -56
- data/culture/tasks/rspec.rake +0 -5
- data/culture/tasks/rubocop.rake +0 -2
- data/lib/celluloid/actor/manager.rb +0 -7
- data/lib/celluloid/backported.rb +0 -2
- data/lib/celluloid/current.rb +0 -2
- data/lib/celluloid/deprecate.rb +0 -34
- data/lib/celluloid/fiber.rb +0 -32
- data/lib/celluloid/managed.rb +0 -3
- data/lib/celluloid/notices.rb +0 -15
- data/spec/deprecate/actor_system_spec.rb +0 -72
- data/spec/deprecate/block_spec.rb +0 -52
- data/spec/deprecate/calls_spec.rb +0 -39
- data/spec/deprecate/evented_mailbox_spec.rb +0 -34
- data/spec/deprecate/future_spec.rb +0 -32
- data/spec/deprecate/internal_pool_spec.rb +0 -4
- data/spec/support/env.rb +0 -21
@@ -1,39 +0,0 @@
|
|
1
|
-
RSpec.describe "Deprecated Celluloid::SyncCall", actor_system: :global do
|
2
|
-
subject { Celluloid::SyncCall.new }
|
3
|
-
|
4
|
-
let(:actor) { DeprecatedCallExampleActor.new }
|
5
|
-
|
6
|
-
context "when obj does not respond to a method" do
|
7
|
-
it "raises a NoMethodError" do
|
8
|
-
expect do
|
9
|
-
actor.the_method_that_wasnt_there
|
10
|
-
end.to raise_exception(NoMethodError)
|
11
|
-
expect(actor).to be_alive
|
12
|
-
end
|
13
|
-
|
14
|
-
context "when obj raises during inspect" do
|
15
|
-
it "should emulate obj.inspect" do
|
16
|
-
expect(actor).to_not receive(:inspect)
|
17
|
-
expect { actor.no_such_method }.to raise_exception(
|
18
|
-
NoMethodError,
|
19
|
-
/undefined method `no_such_method' for #\<DeprecatedCallExampleActor:0x[a-f0-9]+>/,
|
20
|
-
)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
it "aborts with ArgumentError when a method is called with too many arguments" do
|
26
|
-
expect do
|
27
|
-
actor.actual_method("with too many arguments")
|
28
|
-
end.to raise_exception(ArgumentError)
|
29
|
-
|
30
|
-
expect(actor).to be_alive
|
31
|
-
end
|
32
|
-
|
33
|
-
it "preserves call chains across synchronous calls" do
|
34
|
-
actor2 = DeprecatedCallExampleActor.new(actor)
|
35
|
-
|
36
|
-
uuid, next_actor_uuid = actor2.chained_call_ids
|
37
|
-
expect(uuid).to eq next_actor_uuid
|
38
|
-
end
|
39
|
-
end unless $CELLULOID_BACKPORTED == false
|
@@ -1,34 +0,0 @@
|
|
1
|
-
unless $CELLULOID_BACKPORTED == false
|
2
|
-
class DeprecatedTestEventedMailbox < Celluloid::Mailbox::Evented
|
3
|
-
class Reactor
|
4
|
-
def initialize
|
5
|
-
@condition = ConditionVariable.new
|
6
|
-
@mutex = Mutex.new
|
7
|
-
end
|
8
|
-
|
9
|
-
def wakeup
|
10
|
-
@mutex.synchronize do
|
11
|
-
@condition.signal
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def run_once(timeout)
|
16
|
-
@mutex.synchronize do
|
17
|
-
@condition.wait(@mutex, timeout)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def shutdown
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def initialize
|
26
|
-
super(Reactor)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
RSpec.describe "Deprecated Celluloid::Mailbox::Evented" do
|
31
|
-
subject { DeprecatedTestEventedMailbox.new }
|
32
|
-
it_behaves_like "a Celluloid Mailbox"
|
33
|
-
end
|
34
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
RSpec.describe "Deprecated Celluloid::Future", actor_system: :global do
|
2
|
-
subject { Celluloid::Future.new }
|
3
|
-
|
4
|
-
it "creates future objects that can be retrieved later" do
|
5
|
-
future = Celluloid::Future.new { 40 + 2 }
|
6
|
-
expect(future.value).to eq(42)
|
7
|
-
end
|
8
|
-
|
9
|
-
it "passes arguments to future blocks" do
|
10
|
-
future = Celluloid::Future.new(40) { |n| n + 2 }
|
11
|
-
expect(future.value).to eq(42)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "reraises exceptions that occur when the value is retrieved" do
|
15
|
-
class ExampleError < StandardError; end
|
16
|
-
|
17
|
-
future = Celluloid::Future.new { fail ExampleError, "oh noes crash!" }
|
18
|
-
expect { future.value }.to raise_exception(ExampleError)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "knows if it's got a value yet" do
|
22
|
-
future = Celluloid::Future.new { sleep Specs::TIMER_QUANTUM * 5 }
|
23
|
-
expect(future).not_to be_ready
|
24
|
-
sleep Specs::TIMER_QUANTUM * 6
|
25
|
-
expect(future).to be_ready
|
26
|
-
end
|
27
|
-
|
28
|
-
it "raises TaskTimeout when the future times out" do
|
29
|
-
future = Celluloid::Future.new { sleep 2 }
|
30
|
-
expect { future.value(1) }.to raise_exception(Celluloid::TaskTimeout)
|
31
|
-
end
|
32
|
-
end unless $CELLULOID_BACKPORTED == false
|
data/spec/support/env.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require "nenv"
|
2
|
-
require "dotenv"
|
3
|
-
|
4
|
-
# Default to `pwd`/.env-* ( whatever is in the current directory )
|
5
|
-
# Otherwise take the `.env-*` from the gem itself.
|
6
|
-
unless env = Nenv("celluloid").config_file
|
7
|
-
env = Nenv.ci? ? ".env-ci" : ".env-dev"
|
8
|
-
unless File.exist?(env)
|
9
|
-
env = File.expand_path("../../../#{env}", __FILE__)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
Dotenv.load!(env) rescue nil # If for some reason no .env-* files are available at all, use defaults.
|
14
|
-
|
15
|
-
module Specs
|
16
|
-
class << self
|
17
|
-
def env
|
18
|
-
@env ||= Nenv("celluloid_specs")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|