bunny 0.10.8 → 1.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -4
  3. data/ChangeLog.md +1 -152
  4. data/Gemfile +1 -1
  5. data/README.md +5 -5
  6. data/bunny.gemspec +1 -1
  7. data/lib/bunny.rb +14 -2
  8. data/lib/bunny/channel.rb +94 -158
  9. data/lib/bunny/channel_id_allocator.rb +1 -2
  10. data/lib/bunny/concurrent/condition.rb +1 -2
  11. data/lib/bunny/concurrent/continuation_queue.rb +1 -1
  12. data/lib/bunny/consumer.rb +0 -13
  13. data/lib/bunny/consumer_work_pool.rb +2 -5
  14. data/lib/bunny/delivery_info.rb +1 -3
  15. data/lib/bunny/exceptions.rb +1 -4
  16. data/lib/bunny/heartbeat_sender.rb +1 -1
  17. data/lib/bunny/reader_loop.rb +3 -23
  18. data/lib/bunny/session.rb +19 -103
  19. data/lib/bunny/socket.rb +1 -1
  20. data/lib/bunny/transport.rb +7 -31
  21. data/lib/bunny/version.rb +1 -1
  22. data/spec/higher_level_api/integration/basic_ack_spec.rb +19 -34
  23. data/spec/higher_level_api/integration/basic_cancel_spec.rb +1 -1
  24. data/spec/higher_level_api/integration/basic_consume_spec.rb +2 -63
  25. data/spec/higher_level_api/integration/basic_get_spec.rb +1 -1
  26. data/spec/higher_level_api/integration/basic_nack_spec.rb +1 -1
  27. data/spec/higher_level_api/integration/basic_publish_spec.rb +1 -1
  28. data/spec/higher_level_api/integration/basic_qos_spec.rb +8 -5
  29. data/spec/higher_level_api/integration/basic_reject_spec.rb +17 -16
  30. data/spec/higher_level_api/integration/basic_return_spec.rb +1 -1
  31. data/spec/higher_level_api/integration/channel_close_spec.rb +10 -6
  32. data/spec/higher_level_api/integration/channel_flow_spec.rb +9 -6
  33. data/spec/higher_level_api/integration/channel_open_spec.rb +20 -11
  34. data/spec/higher_level_api/integration/confirm_select_spec.rb +1 -1
  35. data/spec/higher_level_api/integration/connection_spec.rb +1 -1
  36. data/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb +1 -1
  37. data/spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb +1 -46
  38. data/spec/higher_level_api/integration/dead_lettering_spec.rb +1 -1
  39. data/spec/higher_level_api/integration/exchange_bind_spec.rb +1 -1
  40. data/spec/higher_level_api/integration/exchange_declare_spec.rb +1 -1
  41. data/spec/higher_level_api/integration/exchange_delete_spec.rb +1 -1
  42. data/spec/higher_level_api/integration/exchange_unbind_spec.rb +1 -1
  43. data/spec/higher_level_api/integration/merry_go_round_spec.rb +1 -1
  44. data/spec/higher_level_api/integration/message_properties_access_spec.rb +1 -1
  45. data/spec/higher_level_api/integration/predeclared_exchanges_spec.rb +1 -1
  46. data/spec/higher_level_api/integration/publishing_edge_cases_spec.rb +1 -1
  47. data/spec/higher_level_api/integration/queue_declare_spec.rb +1 -1
  48. data/spec/higher_level_api/integration/queue_delete_spec.rb +2 -2
  49. data/spec/higher_level_api/integration/queue_purge_spec.rb +1 -1
  50. data/spec/higher_level_api/integration/queue_unbind_spec.rb +2 -2
  51. data/spec/higher_level_api/integration/read_only_consumer_spec.rb +1 -1
  52. data/spec/higher_level_api/integration/sender_selected_distribution_spec.rb +2 -2
  53. data/spec/higher_level_api/integration/tls_connection_spec.rb +2 -86
  54. data/spec/higher_level_api/integration/tx_commit_spec.rb +1 -1
  55. data/spec/higher_level_api/integration/tx_rollback_spec.rb +1 -1
  56. data/spec/unit/concurrent/condition_spec.rb +46 -53
  57. metadata +5 -25
  58. data/benchmarks/mutex_and_monitor.rb +0 -42
  59. data/benchmarks/synchronized_sorted_set.rb +0 -53
  60. data/lib/amq/protocol/extensions.rb +0 -16
  61. data/lib/bunny/concurrent/atomic_fixnum.rb +0 -74
  62. data/lib/bunny/concurrent/synchronized_sorted_set.rb +0 -56
  63. data/lib/bunny/timeout.rb +0 -18
  64. data/lib/bunny/versioned_delivery_tag.rb +0 -28
  65. data/spec/higher_level_api/integration/connection_stop_spec.rb +0 -26
  66. data/spec/higher_level_api/integration/exclusive_queue_spec.rb +0 -28
  67. data/spec/issues/issue141_spec.rb +0 -44
  68. data/spec/stress/connection_open_close_spec.rb +0 -40
  69. data/spec/unit/concurrent/atomic_fixnum_spec.rb +0 -35
  70. data/spec/unit/concurrent/synchronized_sorted_set_spec.rb +0 -73
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.8
4
+ version: 1.0.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Duncan
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-10-03 00:00:00.000000000 Z
15
+ date: 2013-07-25 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: amq-protocol
@@ -28,8 +28,7 @@ dependencies:
28
28
  - - '>='
29
29
  - !ruby/object:Gem::Version
30
30
  version: 1.6.0
31
- description: Easy to use, feature complete Ruby client for RabbitMQ 2.0 and later
32
- versions.
31
+ description: Easy to use, feature complete Ruby client for RabbitMQ 2.0.
33
32
  email:
34
33
  - celldee@gmail.com
35
34
  - eric@5stops.com
@@ -55,11 +54,9 @@ files:
55
54
  - benchmarks/basic_publish/with_4K_messages.rb
56
55
  - benchmarks/basic_publish/with_64K_messages.rb
57
56
  - benchmarks/channel_open.rb
58
- - benchmarks/mutex_and_monitor.rb
59
57
  - benchmarks/queue_declare.rb
60
58
  - benchmarks/queue_declare_and_bind.rb
61
59
  - benchmarks/queue_declare_bind_and_delete.rb
62
- - benchmarks/synchronized_sorted_set.rb
63
60
  - benchmarks/write_vs_write_nonblock.rb
64
61
  - bin/ci/before_build.sh
65
62
  - bunny.gemspec
@@ -93,7 +90,6 @@ files:
93
90
  - examples/guides/getting_started/weathr.rb
94
91
  - examples/guides/queues/one_off_consumer.rb
95
92
  - examples/guides/queues/redeliveries.rb
96
- - lib/amq/protocol/extensions.rb
97
93
  - lib/bunny.rb
98
94
  - lib/bunny/authentication/credentials_encoder.rb
99
95
  - lib/bunny/authentication/external_mechanism_encoder.rb
@@ -101,11 +97,9 @@ files:
101
97
  - lib/bunny/channel.rb
102
98
  - lib/bunny/channel_id_allocator.rb
103
99
  - lib/bunny/compatibility.rb
104
- - lib/bunny/concurrent/atomic_fixnum.rb
105
100
  - lib/bunny/concurrent/condition.rb
106
101
  - lib/bunny/concurrent/continuation_queue.rb
107
102
  - lib/bunny/concurrent/linked_continuation_queue.rb
108
- - lib/bunny/concurrent/synchronized_sorted_set.rb
109
103
  - lib/bunny/consumer.rb
110
104
  - lib/bunny/consumer_tag_generator.rb
111
105
  - lib/bunny/consumer_work_pool.rb
@@ -123,10 +117,8 @@ files:
123
117
  - lib/bunny/ssl_socket.rb
124
118
  - lib/bunny/system_timer.rb
125
119
  - lib/bunny/test_kit.rb
126
- - lib/bunny/timeout.rb
127
120
  - lib/bunny/transport.rb
128
121
  - lib/bunny/version.rb
129
- - lib/bunny/versioned_delivery_tag.rb
130
122
  - profiling/basic_publish/with_4K_messages.rb
131
123
  - spec/compatibility/queue_declare_spec.rb
132
124
  - spec/compatibility/queue_declare_with_default_channel_spec.rb
@@ -145,7 +137,6 @@ files:
145
137
  - spec/higher_level_api/integration/channel_open_spec.rb
146
138
  - spec/higher_level_api/integration/confirm_select_spec.rb
147
139
  - spec/higher_level_api/integration/connection_spec.rb
148
- - spec/higher_level_api/integration/connection_stop_spec.rb
149
140
  - spec/higher_level_api/integration/consistent_hash_exchange_spec.rb
150
141
  - spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb
151
142
  - spec/higher_level_api/integration/dead_lettering_spec.rb
@@ -153,7 +144,6 @@ files:
153
144
  - spec/higher_level_api/integration/exchange_declare_spec.rb
154
145
  - spec/higher_level_api/integration/exchange_delete_spec.rb
155
146
  - spec/higher_level_api/integration/exchange_unbind_spec.rb
156
- - spec/higher_level_api/integration/exclusive_queue_spec.rb
157
147
  - spec/higher_level_api/integration/heartbeat_spec.rb
158
148
  - spec/higher_level_api/integration/merry_go_round_spec.rb
159
149
  - spec/higher_level_api/integration/message_properties_access_spec.rb
@@ -171,7 +161,6 @@ files:
171
161
  - spec/higher_level_api/integration/tx_commit_spec.rb
172
162
  - spec/higher_level_api/integration/tx_rollback_spec.rb
173
163
  - spec/issues/issue100_spec.rb
174
- - spec/issues/issue141_spec.rb
175
164
  - spec/issues/issue78_spec.rb
176
165
  - spec/issues/issue83_spec.rb
177
166
  - spec/issues/issue97_attachment.json
@@ -183,7 +172,6 @@ files:
183
172
  - spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb
184
173
  - spec/stress/concurrent_consumers_stress_spec.rb
185
174
  - spec/stress/concurrent_publishers_stress_spec.rb
186
- - spec/stress/connection_open_close_spec.rb
187
175
  - spec/stress/long_running_consumer_spec.rb
188
176
  - spec/tls/cacert.pem
189
177
  - spec/tls/client_cert.pem
@@ -191,10 +179,8 @@ files:
191
179
  - spec/tls/server_cert.pem
192
180
  - spec/tls/server_key.pem
193
181
  - spec/unit/bunny_spec.rb
194
- - spec/unit/concurrent/atomic_fixnum_spec.rb
195
182
  - spec/unit/concurrent/condition_spec.rb
196
183
  - spec/unit/concurrent/linked_continuation_queue_spec.rb
197
- - spec/unit/concurrent/synchronized_sorted_set_spec.rb
198
184
  homepage: http://rubybunny.info
199
185
  licenses:
200
186
  - MIT
@@ -210,9 +196,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
210
196
  version: '0'
211
197
  required_rubygems_version: !ruby/object:Gem::Requirement
212
198
  requirements:
213
- - - '>='
199
+ - - '>'
214
200
  - !ruby/object:Gem::Version
215
- version: '0'
201
+ version: 1.3.1
216
202
  requirements: []
217
203
  rubyforge_project:
218
204
  rubygems_version: 2.0.5
@@ -237,7 +223,6 @@ test_files:
237
223
  - spec/higher_level_api/integration/channel_open_spec.rb
238
224
  - spec/higher_level_api/integration/confirm_select_spec.rb
239
225
  - spec/higher_level_api/integration/connection_spec.rb
240
- - spec/higher_level_api/integration/connection_stop_spec.rb
241
226
  - spec/higher_level_api/integration/consistent_hash_exchange_spec.rb
242
227
  - spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb
243
228
  - spec/higher_level_api/integration/dead_lettering_spec.rb
@@ -245,7 +230,6 @@ test_files:
245
230
  - spec/higher_level_api/integration/exchange_declare_spec.rb
246
231
  - spec/higher_level_api/integration/exchange_delete_spec.rb
247
232
  - spec/higher_level_api/integration/exchange_unbind_spec.rb
248
- - spec/higher_level_api/integration/exclusive_queue_spec.rb
249
233
  - spec/higher_level_api/integration/heartbeat_spec.rb
250
234
  - spec/higher_level_api/integration/merry_go_round_spec.rb
251
235
  - spec/higher_level_api/integration/message_properties_access_spec.rb
@@ -263,7 +247,6 @@ test_files:
263
247
  - spec/higher_level_api/integration/tx_commit_spec.rb
264
248
  - spec/higher_level_api/integration/tx_rollback_spec.rb
265
249
  - spec/issues/issue100_spec.rb
266
- - spec/issues/issue141_spec.rb
267
250
  - spec/issues/issue78_spec.rb
268
251
  - spec/issues/issue83_spec.rb
269
252
  - spec/issues/issue97_attachment.json
@@ -275,7 +258,6 @@ test_files:
275
258
  - spec/stress/channel_open_stress_with_single_threaded_connection_spec.rb
276
259
  - spec/stress/concurrent_consumers_stress_spec.rb
277
260
  - spec/stress/concurrent_publishers_stress_spec.rb
278
- - spec/stress/connection_open_close_spec.rb
279
261
  - spec/stress/long_running_consumer_spec.rb
280
262
  - spec/tls/cacert.pem
281
263
  - spec/tls/client_cert.pem
@@ -283,8 +265,6 @@ test_files:
283
265
  - spec/tls/server_cert.pem
284
266
  - spec/tls/server_key.pem
285
267
  - spec/unit/bunny_spec.rb
286
- - spec/unit/concurrent/atomic_fixnum_spec.rb
287
268
  - spec/unit/concurrent/condition_spec.rb
288
269
  - spec/unit/concurrent/linked_continuation_queue_spec.rb
289
- - spec/unit/concurrent/synchronized_sorted_set_spec.rb
290
270
  has_rdoc: true
@@ -1,42 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require "rubygems"
5
- require "set"
6
- require "thread"
7
- require "benchmark"
8
- require "monitor"
9
-
10
- puts
11
- puts "-" * 80
12
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
13
-
14
- n = 2_000_000
15
- mx = Mutex.new
16
- mt = Monitor.new
17
-
18
- # warm up the JIT, etc
19
- puts "Doing a warmup run..."
20
- n.times do |i|
21
- mx.synchronize { 1 }
22
- mt.synchronize { 1 }
23
- end
24
-
25
- t1 = Benchmark.realtime do
26
- n.times do |i|
27
- mx.synchronize { 1 }
28
- end
29
- end
30
- r1 = (n.to_f/t1.to_f)
31
-
32
- t2 = Benchmark.realtime do
33
- n.times do |i|
34
- mt.synchronize { 1 }
35
- end
36
- end
37
- r2 = (n.to_f/t2.to_f)
38
-
39
- puts "Mutex#synchronize, rate: #{(r1 / 1000).round(2)} KGHz"
40
- puts "Monitor#synchronize, rate: #{(r2 / 1000).round(2)} KGHz"
41
- puts
42
- puts "-" * 80
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- require "rubygems"
5
- require "set"
6
- require "thread"
7
- require "benchmark"
8
-
9
- require "bunny/concurrent/synchronized_sorted_set"
10
-
11
- puts
12
- puts "-" * 80
13
- puts "Benchmarking on #{RUBY_DESCRIPTION}"
14
-
15
- n = 2_000_000
16
- s = SortedSet.new
17
-
18
- # warm up the JIT, etc
19
- puts "Doing a warmup run..."
20
- n.times do |i|
21
- s << 1
22
- s << i
23
- s.delete i
24
- s << i
25
- end
26
-
27
- t1 = Benchmark.realtime do
28
- n.times do |i|
29
- s << 1
30
- s << i
31
- s.delete i
32
- s << i
33
- s.length
34
- end
35
- end
36
- r1 = (n.to_f/t1.to_f)
37
-
38
- s2 = SynchronizedSortedSet.new
39
- t2 = Benchmark.realtime do
40
- n.times do |i|
41
- s2 << 1
42
- s2 << i
43
- s2.delete i
44
- s2 << i
45
- s2.length
46
- end
47
- end
48
- r2 = (n.to_f/t2.to_f)
49
-
50
- puts "Mixed sorted set ops, rate: #{(r1 / 1000).round(2)} KGHz"
51
- puts "Mixed synchronized sorted set ops, rate: #{(r2 / 1000).round(2)} KGHz"
52
- puts
53
- puts "-" * 80
@@ -1,16 +0,0 @@
1
- # @private
2
- module AMQ
3
- # @private
4
- module Protocol
5
- # @private
6
- class Basic
7
- # Extended to allow wrapping delivery tag into
8
- # a versioned one.
9
- #
10
- # @private
11
- class GetOk
12
- attr_writer :delivery_tag
13
- end
14
- end
15
- end
16
- end
@@ -1,74 +0,0 @@
1
- require "set"
2
- require "thread"
3
- require "monitor"
4
-
5
- module Bunny
6
- module Concurrent
7
- # Minimalistic implementation of a synchronized fixnum value,
8
- # designed after (but not implementing the entire API of!)
9
- #
10
- # @note Designed to be intentionally minimalistic and only cover Bunny's needs.
11
- #
12
- # @api public
13
- class AtomicFixnum
14
- def initialize(n = 0)
15
- @n = n
16
- @mutex = Monitor.new
17
- end
18
-
19
- def get
20
- @mutex.synchronize do
21
- @n
22
- end
23
- end
24
-
25
- def set(n)
26
- @mutex.synchronize do
27
- @n = n
28
- end
29
- end
30
-
31
- def increment
32
- @mutex.synchronize do
33
- @n = @n + 1
34
- end
35
- end
36
- alias inc increment
37
- alias increment_and_get increment
38
-
39
- def get_and_add(i)
40
- @mutex.synchronize do
41
- v = @n
42
- @n = @n + i
43
-
44
- v
45
- end
46
- end
47
-
48
- def get_and_increment
49
- @mutex.synchronize do
50
- v = @n
51
- @n = @n + 1
52
-
53
- v
54
- end
55
- end
56
-
57
- def decrement
58
- @mutex.synchronize do
59
- @n = @n - 1
60
- end
61
- end
62
- alias dec decrement
63
- alias decrement_and_get decrement
64
-
65
- def ==(m)
66
- @mutex.synchronize { @n == m }
67
- end
68
-
69
- def ===(v)
70
- @mutex.synchronize { @n === v }
71
- end
72
- end
73
- end
74
- end
@@ -1,56 +0,0 @@
1
- require "set"
2
- require "thread"
3
-
4
- module Bunny
5
- module Concurrent
6
- # A SortedSet variation that synchronizes key mutation operations.
7
- #
8
- # @note This is NOT a complete SortedSet replacement. It only synchronizes operations needed by Bunny.
9
- # @api public
10
- class SynchronizedSortedSet < SortedSet
11
- def initialize(enum = nil)
12
- @mutex = Mutex.new
13
-
14
- super
15
- end
16
-
17
- def add(o)
18
- # avoid using Mutex#synchronize because of a Ruby 1.8.7-specific
19
- # bug that prevents super from being called from within a block. MK.
20
- @mutex.lock
21
- begin
22
- super
23
- ensure
24
- @mutex.unlock
25
- end
26
- end
27
-
28
- def delete(o)
29
- @mutex.lock
30
- begin
31
- super
32
- ensure
33
- @mutex.unlock
34
- end
35
- end
36
-
37
- def delete_if(&block)
38
- @mutex.lock
39
- begin
40
- super
41
- ensure
42
- @mutex.unlock
43
- end
44
- end
45
-
46
- def include?(o)
47
- @mutex.lock
48
- begin
49
- super
50
- ensure
51
- @mutex.unlock
52
- end
53
- end
54
- end
55
- end
56
- end
data/lib/bunny/timeout.rb DELETED
@@ -1,18 +0,0 @@
1
- module Bunny
2
- # Unifies Ruby standard library's Timeout (which is not accurate on
3
- # Ruby 1.8) and SystemTimer (the gem)
4
- Timeout = if RUBY_VERSION < "1.9"
5
- begin
6
- require "bunny/system_timer"
7
- Bunny::SystemTimer
8
- rescue LoadError
9
- Timeout
10
- end
11
- else
12
- Timeout
13
- end
14
-
15
- # Backwards compatibility
16
- # @private
17
- Timer = Timeout
18
- end
@@ -1,28 +0,0 @@
1
- module Bunny
2
- # Wraps a delivery tag (which is an integer) so that {Bunny::Channel} could
3
- # detect stale tags after connection recovery.
4
- #
5
- # @private
6
- class VersionedDeliveryTag
7
- attr_reader :tag
8
- attr_reader :version
9
-
10
- def initialize(tag, version)
11
- raise ArgumentError.new("tag cannot be nil") unless tag
12
- raise ArgumentError.new("version cannot be nil") unless version
13
-
14
- @tag = tag
15
- @version = version
16
- end
17
-
18
- def to_i
19
- @tag
20
- end
21
-
22
- def stale?(version)
23
- raise ArgumentError.new("version cannot be nil") unless version
24
-
25
- @version < version
26
- end
27
- end
28
- end