amq-protocol 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1f186e3bf24e927b6711cda58c42003a46cd481c
4
+ data.tar.gz: f77baf1386daf522b006608a90714df0e97781bb
5
+ SHA512:
6
+ metadata.gz: 703d318cd4bddf254866c15b2870e14e28d2817687763f294e5d7c66e6c1b6026a9f60243803e29d4868129478a89ba07805610dcbbf6515159a293949b9ccad
7
+ data.tar.gz: 187fa32ab85369862486497e5663f229b741d9034b7e8bba2a869c9f9968b18f223df79decdf705cc00277e9ca8f1e169829edc7b3d65d2f1804cfbb48acb65d
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  /*.gem
2
2
  /.rvmrc
3
+ /.ruby-version
3
4
  tmp
4
5
  *.pyc
5
6
  /vendor/bundle
@@ -2,14 +2,15 @@ language: ruby
2
2
  bundler_args: --without development
3
3
  script: "bundle exec rspec spec"
4
4
  rvm:
5
- - 1.8.7
6
- - rbx-18mode
7
- - rbx-19mode
8
- - 1.9.2
5
+ - 2.0
9
6
  - 1.9.3
10
- - ruby-head
11
7
  - jruby-19mode
8
+ - 1.9.2
9
+ - rbx-19mode
10
+ - ruby-head
12
11
  - jruby-head
12
+ - 1.8.7
13
+ - rbx-18mode
13
14
  notifications:
14
15
  recipients:
15
16
  - michael@novemberain.com
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
- source :rubygems
3
+ source "https://rubygems.org"
4
4
 
5
5
  group :development do
6
6
  # excludes Windows, Rubinius and JRuby
@@ -8,6 +8,6 @@ group :development do
8
8
  end
9
9
 
10
10
  group :test do
11
- gem "rspec", ">= 2.6.0"
11
+ gem "rspec", ">= 2.13.0"
12
12
  gem "effin_utf8"
13
13
  end
@@ -12,7 +12,7 @@ from amqp_codegen import *
12
12
  try:
13
13
  from mako.template import Template
14
14
  except ImportError:
15
- print "Mako isn't installed. Run easy_install mako."
15
+ print "Mako isn't installed. Please install mako via pip or similar."
16
16
  sys.exit(1)
17
17
 
18
18
  # main class
@@ -46,10 +46,6 @@ class AmqpSpecObject(AmqpSpec):
46
46
 
47
47
  self.classes = filter(lambda klass: not klass.ignored, self.classes)
48
48
 
49
- # I know, I'm a bad, bad boy, but come on guys,
50
- # monkey-patching is just handy for this case.
51
- # Oh hell, why Python doesn't have at least
52
- # anonymous functions? This looks so ugly.
53
49
  original_init = AmqpEntity.__init__
54
50
  def new_init(self, arg):
55
51
  original_init(self, arg)
@@ -5,6 +5,8 @@ def sh(*args)
5
5
  system(*args)
6
6
  end
7
7
 
8
+ extensions = ["codegen/rabbitmq-codegen/credit_extension.json"]
9
+
8
10
  spec = "codegen/rabbitmq-codegen/amqp-rabbitmq-0.9.1.json"
9
11
  unless File.exist?(spec)
10
12
  sh "git submodule update --init"
@@ -12,7 +14,7 @@ end
12
14
 
13
15
  path = "lib/amq/protocol/client.rb"
14
16
  puts "Running ./codegen/codegen.py client #{spec} #{path}"
15
- sh "./codegen/codegen.py client #{spec} #{path}"
17
+ sh "./codegen/codegen.py client #{spec} #{extensions.join(' ')} #{path}"
16
18
  if File.file?(path)
17
19
  sh "ruby -c #{path}"
18
20
  end
@@ -2165,6 +2165,129 @@ module AMQ
2165
2165
 
2166
2166
  end
2167
2167
 
2168
+ class Credit < Protocol::Method
2169
+ @name = "basic.credit"
2170
+ @method_id = 200
2171
+ @index = 0x003C00C8 # 60, 200, 3932360
2172
+ @packed_indexes = [60, 200].pack(PACK_UINT16_X2).freeze
2173
+
2174
+ # @return
2175
+ def self.decode(data)
2176
+ offset = 0
2177
+ length = data[offset, 1].unpack(PACK_CHAR).first
2178
+ offset += 1
2179
+ consumer_tag = data[offset, length]
2180
+ offset += length
2181
+ credit = data[offset, 4].unpack(PACK_UINT32).first
2182
+ offset += 4
2183
+ bit_buffer = data[offset, 1].unpack(PACK_CHAR).first
2184
+ offset += 1
2185
+ drain = (bit_buffer & (1 << 0)) != 0
2186
+ self.new(consumer_tag, credit, drain)
2187
+ end
2188
+
2189
+ attr_reader :consumer_tag, :credit, :drain
2190
+ def initialize(consumer_tag, credit, drain)
2191
+ @consumer_tag = consumer_tag
2192
+ @credit = credit
2193
+ @drain = drain
2194
+ end
2195
+
2196
+ def self.has_content?
2197
+ false
2198
+ end
2199
+
2200
+ # @return
2201
+ # [u'consumer_tag = EMPTY_STRING', u'credit = nil', u'drain = nil']
2202
+ def self.encode(channel, consumer_tag, credit, drain)
2203
+ buffer = ''
2204
+ buffer << @packed_indexes
2205
+ buffer << consumer_tag.to_s.bytesize.chr
2206
+ buffer << consumer_tag.to_s
2207
+ buffer << [credit].pack(PACK_UINT32)
2208
+ bit_buffer = 0
2209
+ bit_buffer = bit_buffer | (1 << 0) if drain
2210
+ buffer << [bit_buffer].pack(PACK_CHAR)
2211
+ MethodFrame.new(buffer, channel)
2212
+ end
2213
+
2214
+ end
2215
+
2216
+ class CreditOk < Protocol::Method
2217
+ @name = "basic.credit-ok"
2218
+ @method_id = 201
2219
+ @index = 0x003C00C9 # 60, 201, 3932361
2220
+ @packed_indexes = [60, 201].pack(PACK_UINT16_X2).freeze
2221
+
2222
+ # @return
2223
+ def self.decode(data)
2224
+ offset = 0
2225
+ available = data[offset, 4].unpack(PACK_UINT32).first
2226
+ offset += 4
2227
+ self.new(available)
2228
+ end
2229
+
2230
+ attr_reader :available
2231
+ def initialize(available)
2232
+ @available = available
2233
+ end
2234
+
2235
+ def self.has_content?
2236
+ false
2237
+ end
2238
+
2239
+ # @return
2240
+ # [u'available = nil']
2241
+ def self.encode(channel, available)
2242
+ buffer = ''
2243
+ buffer << @packed_indexes
2244
+ buffer << [available].pack(PACK_UINT32)
2245
+ MethodFrame.new(buffer, channel)
2246
+ end
2247
+
2248
+ end
2249
+
2250
+ class CreditDrained < Protocol::Method
2251
+ @name = "basic.credit-drained"
2252
+ @method_id = 202
2253
+ @index = 0x003C00CA # 60, 202, 3932362
2254
+ @packed_indexes = [60, 202].pack(PACK_UINT16_X2).freeze
2255
+
2256
+ # @return
2257
+ def self.decode(data)
2258
+ offset = 0
2259
+ length = data[offset, 1].unpack(PACK_CHAR).first
2260
+ offset += 1
2261
+ consumer_tag = data[offset, length]
2262
+ offset += length
2263
+ credit_drained = data[offset, 4].unpack(PACK_UINT32).first
2264
+ offset += 4
2265
+ self.new(consumer_tag, credit_drained)
2266
+ end
2267
+
2268
+ attr_reader :consumer_tag, :credit_drained
2269
+ def initialize(consumer_tag, credit_drained)
2270
+ @consumer_tag = consumer_tag
2271
+ @credit_drained = credit_drained
2272
+ end
2273
+
2274
+ def self.has_content?
2275
+ false
2276
+ end
2277
+
2278
+ # @return
2279
+ # [u'consumer_tag = EMPTY_STRING', u'credit_drained = nil']
2280
+ def self.encode(channel, consumer_tag, credit_drained)
2281
+ buffer = ''
2282
+ buffer << @packed_indexes
2283
+ buffer << consumer_tag.to_s.bytesize.chr
2284
+ buffer << consumer_tag.to_s
2285
+ buffer << [credit_drained].pack(PACK_UINT32)
2286
+ MethodFrame.new(buffer, channel)
2287
+ end
2288
+
2289
+ end
2290
+
2168
2291
  end
2169
2292
 
2170
2293
  class Tx < Protocol::Class
@@ -1,5 +1,5 @@
1
1
  module AMQ
2
2
  module Protocol
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.0"
4
4
  end # Protocol
5
5
  end # AMQ
@@ -20,7 +20,7 @@ require "amq/protocol"
20
20
 
21
21
  puts "Running on #{RUBY_VERSION}"
22
22
 
23
- module RubyVersionsSUpport
23
+ module RubyVersionsSupport
24
24
  def one_point_eight?
25
25
  RUBY_VERSION =~ /^1.8/
26
26
  end
@@ -30,6 +30,6 @@ end # RubyVersionsSUpport
30
30
  RSpec.configure do |config|
31
31
  config.include AMQ::Protocol
32
32
 
33
- config.include(RubyVersionsSUpport)
34
- config.extend(RubyVersionsSUpport)
33
+ config.include(RubyVersionsSupport)
34
+ config.extend(RubyVersionsSupport)
35
35
  end
metadata CHANGED
@@ -1,107 +1,102 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: amq-protocol
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.3.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.0
6
5
  platform: ruby
7
- authors:
8
- - Jakub Stastny
9
- - Michael S. Klishin
10
- - Theo Hultberg
11
- - Mark Abramov
6
+ authors:
7
+ - Jakub Stastny
8
+ - Michael S. Klishin
9
+ - Theo Hultberg
10
+ - Mark Abramov
12
11
  autorequire:
13
12
  bindir: bin
14
13
  cert_chain: []
15
-
16
- date: 2013-04-10 00:00:00 Z
14
+ date: 2013-04-30 00:00:00.000000000 Z
17
15
  dependencies: []
18
-
19
- description: " amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not an\n AMQP client: amq-protocol only handles serialization and deserialization.\n If you want to write your own AMQP client, this gem can help you with that.\n"
20
- email:
21
- - michael@novemberain.com
22
- - stastny@101ideas.cz
16
+ description: |2
17
+ amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not an
18
+ AMQP client: amq-protocol only handles serialization and deserialization.
19
+ If you want to write your own AMQP client, this gem can help you with that.
20
+ email:
21
+ - michael@novemberain.com
22
+ - stastny@101ideas.cz
23
23
  executables: []
24
-
25
24
  extensions: []
26
-
27
- extra_rdoc_files:
28
- - README.md
29
- files:
30
- - .gitignore
31
- - .gitmodules
32
- - .rspec
33
- - .travis.yml
34
- - ChangeLog.md
35
- - Gemfile
36
- - LICENSE
37
- - PROFILING.md
38
- - README.md
39
- - amq-protocol.gemspec
40
- - codegen/__init__.py
41
- - codegen/amqp_0.9.1_changes.json
42
- - codegen/codegen.py
43
- - codegen/codegen_helpers.py
44
- - codegen/protocol.rb.pytemplate
45
- - generate.rb
46
- - lib/amq/bit_set.rb
47
- - lib/amq/endianness.rb
48
- - lib/amq/hacks.rb
49
- - lib/amq/int_allocator.rb
50
- - lib/amq/protocol.rb
51
- - lib/amq/protocol/client.rb
52
- - lib/amq/protocol/frame.rb
53
- - lib/amq/protocol/table.rb
54
- - lib/amq/protocol/table_value_decoder.rb
55
- - lib/amq/protocol/table_value_encoder.rb
56
- - lib/amq/protocol/type_constants.rb
57
- - lib/amq/protocol/version.rb
58
- - lib/amq/settings.rb
59
- - spec/amq/bit_set_spec.rb
60
- - spec/amq/hacks_spec.rb
61
- - spec/amq/int_allocator_spec.rb
62
- - spec/amq/protocol/basic_spec.rb
63
- - spec/amq/protocol/blank_body_encoding_spec.rb
64
- - spec/amq/protocol/channel_spec.rb
65
- - spec/amq/protocol/confirm_spec.rb
66
- - spec/amq/protocol/connection_spec.rb
67
- - spec/amq/protocol/constants_spec.rb
68
- - spec/amq/protocol/exchange_spec.rb
69
- - spec/amq/protocol/frame_spec.rb
70
- - spec/amq/protocol/method_spec.rb
71
- - spec/amq/protocol/queue_spec.rb
72
- - spec/amq/protocol/table_spec.rb
73
- - spec/amq/protocol/tx_spec.rb
74
- - spec/amq/protocol/value_decoder_spec.rb
75
- - spec/amq/protocol/value_encoder_spec.rb
76
- - spec/amq/protocol_spec.rb
77
- - spec/amq/settings_spec.rb
78
- - spec/spec_helper.rb
25
+ extra_rdoc_files:
26
+ - README.md
27
+ files:
28
+ - .gitignore
29
+ - .gitmodules
30
+ - .rspec
31
+ - .travis.yml
32
+ - ChangeLog.md
33
+ - Gemfile
34
+ - LICENSE
35
+ - PROFILING.md
36
+ - README.md
37
+ - amq-protocol.gemspec
38
+ - codegen/__init__.py
39
+ - codegen/amqp_0.9.1_changes.json
40
+ - codegen/codegen.py
41
+ - codegen/codegen_helpers.py
42
+ - codegen/protocol.rb.pytemplate
43
+ - generate.rb
44
+ - lib/amq/bit_set.rb
45
+ - lib/amq/endianness.rb
46
+ - lib/amq/hacks.rb
47
+ - lib/amq/int_allocator.rb
48
+ - lib/amq/protocol.rb
49
+ - lib/amq/protocol/client.rb
50
+ - lib/amq/protocol/frame.rb
51
+ - lib/amq/protocol/table.rb
52
+ - lib/amq/protocol/table_value_decoder.rb
53
+ - lib/amq/protocol/table_value_encoder.rb
54
+ - lib/amq/protocol/type_constants.rb
55
+ - lib/amq/protocol/version.rb
56
+ - lib/amq/settings.rb
57
+ - spec/amq/bit_set_spec.rb
58
+ - spec/amq/hacks_spec.rb
59
+ - spec/amq/int_allocator_spec.rb
60
+ - spec/amq/protocol/basic_spec.rb
61
+ - spec/amq/protocol/blank_body_encoding_spec.rb
62
+ - spec/amq/protocol/channel_spec.rb
63
+ - spec/amq/protocol/confirm_spec.rb
64
+ - spec/amq/protocol/connection_spec.rb
65
+ - spec/amq/protocol/constants_spec.rb
66
+ - spec/amq/protocol/exchange_spec.rb
67
+ - spec/amq/protocol/frame_spec.rb
68
+ - spec/amq/protocol/method_spec.rb
69
+ - spec/amq/protocol/queue_spec.rb
70
+ - spec/amq/protocol/table_spec.rb
71
+ - spec/amq/protocol/tx_spec.rb
72
+ - spec/amq/protocol/value_decoder_spec.rb
73
+ - spec/amq/protocol/value_encoder_spec.rb
74
+ - spec/amq/protocol_spec.rb
75
+ - spec/amq/settings_spec.rb
76
+ - spec/spec_helper.rb
79
77
  homepage: http://github.com/ruby-amqp/amq-protocol
80
- licenses:
81
- - MIT
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
82
81
  post_install_message:
83
82
  rdoc_options: []
84
-
85
- require_paths:
86
- - lib
87
- required_ruby_version: !ruby/object:Gem::Requirement
88
- none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: "0"
93
- required_rubygems_version: !ruby/object:Gem::Requirement
94
- none: false
95
- requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- version: "0"
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
99
95
  requirements: []
100
-
101
96
  rubyforge_project: amq-protocol
102
- rubygems_version: 1.8.24
97
+ rubygems_version: 2.0.3
103
98
  signing_key:
104
- specification_version: 3
99
+ specification_version: 4
105
100
  summary: AMQP 0.9.1 encoder & decoder.
106
101
  test_files: []
107
-
102
+ has_rdoc: