zookeeper 1.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.dotfiles/rvmrc +1 -0
- data/.travis.yml +5 -0
- data/CHANGELOG +13 -0
- data/Gemfile +3 -0
- data/Guardfile +6 -0
- data/README.markdown +16 -12
- data/Rakefile +5 -0
- data/cause-abort.rb +117 -0
- data/ext/Rakefile +34 -21
- data/ext/c_zookeeper.rb +181 -70
- data/ext/common.h +7 -0
- data/ext/depend +2 -2
- data/ext/{zookeeper_lib.c → event_lib.c} +107 -66
- data/ext/{zookeeper_lib.h → event_lib.h} +4 -3
- data/ext/extconf.rb +12 -8
- data/ext/generate_gvl_code.rb +9 -2
- data/ext/{zookeeper_c.c → zkrb.c} +415 -176
- data/ext/zookeeper_base.rb +7 -26
- data/lib/zookeeper/client_methods.rb +1 -1
- data/lib/zookeeper/common.rb +3 -2
- data/lib/zookeeper/constants.rb +1 -0
- data/lib/zookeeper/continuation.rb +155 -0
- data/lib/zookeeper/exceptions.rb +7 -0
- data/lib/zookeeper/logger.rb +7 -0
- data/lib/zookeeper/monitor.rb +19 -0
- data/lib/zookeeper/version.rb +1 -1
- data/lib/zookeeper.rb +3 -0
- data/spec/forked_connection_spec.rb +11 -4
- data/spec/shared/connection_examples.rb +24 -22
- data/spec/spec_helper.rb +2 -2
- data/spec/support/zookeeper_spec_helpers.rb +1 -1
- metadata +12 -9
- data/spec/fork_hook_specs.rb +0 -53
data/spec/spec_helper.rb
CHANGED
@@ -32,8 +32,8 @@ end
|
|
32
32
|
|
33
33
|
RSpec.configure do |config|
|
34
34
|
config.mock_with :rspec
|
35
|
-
config.include Zookeeper::
|
36
|
-
config.extend Zookeeper::
|
35
|
+
config.include Zookeeper::SpecHelpers
|
36
|
+
config.extend Zookeeper::SpecHelpers
|
37
37
|
|
38
38
|
if Zookeeper.spawn_zookeeper?
|
39
39
|
require 'zk-server'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zookeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.6
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Phillip Pearson
|
@@ -20,7 +20,7 @@ autorequire:
|
|
20
20
|
bindir: bin
|
21
21
|
cert_chain: []
|
22
22
|
|
23
|
-
date: 2012-05-
|
23
|
+
date: 2012-05-14 00:00:00 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: backports
|
@@ -61,26 +61,29 @@ files:
|
|
61
61
|
- .travis.yml
|
62
62
|
- CHANGELOG
|
63
63
|
- Gemfile
|
64
|
+
- Guardfile
|
64
65
|
- LICENSE
|
65
66
|
- Manifest
|
66
67
|
- README.markdown
|
67
68
|
- Rakefile
|
69
|
+
- cause-abort.rb
|
68
70
|
- ext/.gitignore
|
69
71
|
- ext/Rakefile
|
70
72
|
- ext/c_zookeeper.rb
|
73
|
+
- ext/common.h
|
71
74
|
- ext/dbg.h
|
72
75
|
- ext/depend
|
76
|
+
- ext/event_lib.c
|
77
|
+
- ext/event_lib.h
|
73
78
|
- ext/extconf.rb
|
74
79
|
- ext/generate_gvl_code.rb
|
75
80
|
- ext/zkc-3.3.5.tar.gz
|
81
|
+
- ext/zkrb.c
|
76
82
|
- ext/zkrb_wrapper.c
|
77
83
|
- ext/zkrb_wrapper.h
|
78
84
|
- ext/zkrb_wrapper_compat.c
|
79
85
|
- ext/zkrb_wrapper_compat.h
|
80
86
|
- ext/zookeeper_base.rb
|
81
|
-
- ext/zookeeper_c.c
|
82
|
-
- ext/zookeeper_lib.c
|
83
|
-
- ext/zookeeper_lib.h
|
84
87
|
- java/java_base.rb
|
85
88
|
- lib/zookeeper.rb
|
86
89
|
- lib/zookeeper/acls.rb
|
@@ -91,12 +94,14 @@ files:
|
|
91
94
|
- lib/zookeeper/common/queue_with_pipe.rb
|
92
95
|
- lib/zookeeper/compatibility.rb
|
93
96
|
- lib/zookeeper/constants.rb
|
97
|
+
- lib/zookeeper/continuation.rb
|
94
98
|
- lib/zookeeper/core_ext.rb
|
95
99
|
- lib/zookeeper/em_client.rb
|
96
100
|
- lib/zookeeper/exceptions.rb
|
97
101
|
- lib/zookeeper/forked.rb
|
98
102
|
- lib/zookeeper/latch.rb
|
99
103
|
- lib/zookeeper/logger.rb
|
104
|
+
- lib/zookeeper/monitor.rb
|
100
105
|
- lib/zookeeper/rake_tasks.rb
|
101
106
|
- lib/zookeeper/stat.rb
|
102
107
|
- lib/zookeeper/version.rb
|
@@ -108,7 +113,6 @@ files:
|
|
108
113
|
- spec/default_watcher_spec.rb
|
109
114
|
- spec/em_spec.rb
|
110
115
|
- spec/ext/zookeeper_base_spec.rb
|
111
|
-
- spec/fork_hook_specs.rb
|
112
116
|
- spec/forked_connection_spec.rb
|
113
117
|
- spec/latch_spec.rb
|
114
118
|
- spec/log4j.properties
|
@@ -161,7 +165,6 @@ test_files:
|
|
161
165
|
- spec/default_watcher_spec.rb
|
162
166
|
- spec/em_spec.rb
|
163
167
|
- spec/ext/zookeeper_base_spec.rb
|
164
|
-
- spec/fork_hook_specs.rb
|
165
168
|
- spec/forked_connection_spec.rb
|
166
169
|
- spec/latch_spec.rb
|
167
170
|
- spec/log4j.properties
|
data/spec/fork_hook_specs.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'fork hooks' do
|
4
|
-
def safe_kill_process(signal, pid)
|
5
|
-
Process.kill(signal, pid)
|
6
|
-
rescue Errno::ESRCH
|
7
|
-
nil
|
8
|
-
end
|
9
|
-
|
10
|
-
after do
|
11
|
-
Zookeeper::Forked.clear!
|
12
|
-
|
13
|
-
if @pid
|
14
|
-
safe_kill_process('KILL', @pid)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'fork with a block' do
|
19
|
-
it %[should call the after_fork_in_child hooks in the child] do
|
20
|
-
child_hook_called = false
|
21
|
-
|
22
|
-
hook_order = []
|
23
|
-
|
24
|
-
Zookeeper.prepare_for_fork { hook_order << :prepare }
|
25
|
-
Zookeeper.after_fork_in_parent { hook_order << :parent }
|
26
|
-
Zookeeper.after_fork_in_child { hook_order << :child }
|
27
|
-
|
28
|
-
@pid = fork do
|
29
|
-
unless hook_order.first == :prepare
|
30
|
-
$stderr.puts "hook order wrong! #{hook_order.inspect}"
|
31
|
-
exit! 2
|
32
|
-
end
|
33
|
-
|
34
|
-
unless hook_order.last == :child
|
35
|
-
$stderr.puts "hook order wrong! #{hook_order.inspect}"
|
36
|
-
exit! 3
|
37
|
-
end
|
38
|
-
|
39
|
-
exit! 0
|
40
|
-
end
|
41
|
-
|
42
|
-
hook_order.first.should == :prepare
|
43
|
-
hook_order.last.should == :parent
|
44
|
-
|
45
|
-
_, st = Process.wait2(@pid)
|
46
|
-
st.exitstatus.should == 0
|
47
|
-
|
48
|
-
st.should be_exited
|
49
|
-
st.should be_success
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|