qpid_proton 0.17.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/codec/data.rb CHANGED
@@ -82,13 +82,12 @@ module Qpid::Proton::Codec
82
82
 
83
83
  # Creates a new instance with the specified capacity.
84
84
  #
85
- # @param capacity [Fixnum, Object] The initial capacity or content.
85
+ # @param capacity [Integer, Object] The initial capacity or content.
86
86
  #
87
87
  def initialize(capacity = 16)
88
- if (!capacity.nil?) &&
89
- (capacity.is_a?(Fixnum) ||
90
- capacity.is_a?(Bignum))
91
- @data = Cproton.pn_data(capacity)
88
+ # TODO aconway 2017-08-11: error prone, confusion between capacity and Integer content.
89
+ if capacity.is_a?(Integer)
90
+ @data = Cproton.pn_data(capacity.to_i)
92
91
  @free = true
93
92
  else
94
93
  @data = capacity
@@ -165,7 +164,7 @@ module Qpid::Proton::Codec
165
164
 
166
165
  # Returns the numeric type code of the current node.
167
166
  #
168
- # @return [Fixnum] The current node type.
167
+ # @return [Integer] The current node type.
169
168
  # @return [nil] If there is no current node.
170
169
  #
171
170
  def type_code
@@ -173,10 +172,7 @@ module Qpid::Proton::Codec
173
172
  return (dtype == -1) ? nil : dtype
174
173
  end
175
174
 
176
- # Return the type object for the current node
177
- #
178
- # @param [Fixnum] The object type.
179
- #
175
+ # @return [Integer] The type object for the current node.
180
176
  # @see #type_code
181
177
  #
182
178
  def type
@@ -319,7 +315,7 @@ module Qpid::Proton::Codec
319
315
  # is the descriptor and may be of any type.
320
316
  #
321
317
  # @param described [Boolean] True if the array is described.
322
- # @param element_type [Fixnum] The AMQP type for each element of the array.
318
+ # @param element_type [Integer] The AMQP type for each element of the array.
323
319
  #
324
320
  # @example
325
321
  #
@@ -489,7 +485,7 @@ module Qpid::Proton::Codec
489
485
 
490
486
  # Puts an unsigned byte value.
491
487
  #
492
- # @param value [Fixnum] The unsigned byte value.
488
+ # @param value [Integer] The unsigned byte value.
493
489
  #
494
490
  def ubyte=(value)
495
491
  check(Cproton.pn_data_put_ubyte(@data, value))
@@ -498,7 +494,7 @@ module Qpid::Proton::Codec
498
494
  # If the current node is an unsigned byte, returns its value. Otherwise,
499
495
  # it returns 0.
500
496
  #
501
- # @return [Fixnum] The unsigned byte value.
497
+ # @return [Integer] The unsigned byte value.
502
498
  #
503
499
  def ubyte
504
500
  Cproton.pn_data_get_ubyte(@data)
@@ -506,7 +502,7 @@ module Qpid::Proton::Codec
506
502
 
507
503
  # Puts a byte value.
508
504
  #
509
- # @param value [Fixnum] The byte value.
505
+ # @param value [Integer] The byte value.
510
506
  #
511
507
  def byte=(value)
512
508
  check(Cproton.pn_data_put_byte(@data, value))
@@ -515,7 +511,7 @@ module Qpid::Proton::Codec
515
511
  # If the current node is an byte, returns its value. Otherwise,
516
512
  # it returns 0.
517
513
  #
518
- # @return [Fixnum] The byte value.
514
+ # @return [Integer] The byte value.
519
515
  #
520
516
  def byte
521
517
  Cproton.pn_data_get_byte(@data)
@@ -523,7 +519,7 @@ module Qpid::Proton::Codec
523
519
 
524
520
  # Puts an unsigned short value.
525
521
  #
526
- # @param value [Fixnum] The unsigned short value
522
+ # @param value [Integer] The unsigned short value
527
523
  #
528
524
  def ushort=(value)
529
525
  check(Cproton.pn_data_put_ushort(@data, value))
@@ -532,7 +528,7 @@ module Qpid::Proton::Codec
532
528
  # If the current node is an unsigned short, returns its value. Otherwise,
533
529
  # it returns 0.
534
530
  #
535
- # @return [Fixnum] The unsigned short value.
531
+ # @return [Integer] The unsigned short value.
536
532
  #
537
533
  def ushort
538
534
  Cproton.pn_data_get_ushort(@data)
@@ -540,7 +536,7 @@ module Qpid::Proton::Codec
540
536
 
541
537
  # Puts a short value.
542
538
  #
543
- # @param value [Fixnum] The short value.
539
+ # @param value [Integer] The short value.
544
540
  #
545
541
  def short=(value)
546
542
  check(Cproton.pn_data_put_short(@data, value))
@@ -549,7 +545,7 @@ module Qpid::Proton::Codec
549
545
  # If the current node is a short, returns its value. Otherwise,
550
546
  # returns a 0.
551
547
  #
552
- # @return [Fixnum] The short value.
548
+ # @return [Integer] The short value.
553
549
  #
554
550
  def short
555
551
  Cproton.pn_data_get_short(@data)
@@ -557,7 +553,7 @@ module Qpid::Proton::Codec
557
553
 
558
554
  # Puts an unsigned integer value.
559
555
  #
560
- # @param value [Fixnum] the unsigned integer value
556
+ # @param value [Integer] the unsigned integer value
561
557
  #
562
558
  def uint=(value)
563
559
  raise TypeError if value.nil?
@@ -568,7 +564,7 @@ module Qpid::Proton::Codec
568
564
  # If the current node is an unsigned int, returns its value. Otherwise,
569
565
  # returns 0.
570
566
  #
571
- # @return [Fixnum] The unsigned integer value.
567
+ # @return [Integer] The unsigned integer value.
572
568
  #
573
569
  def uint
574
570
  Cproton.pn_data_get_uint(@data)
@@ -586,7 +582,7 @@ module Qpid::Proton::Codec
586
582
  # If the current node is an integer, returns its value. Otherwise,
587
583
  # returns 0.
588
584
  #
589
- # @return [Fixnum] The integer value.
585
+ # @return [Integer] The integer value.
590
586
  #
591
587
  def int
592
588
  Cproton.pn_data_get_int(@data)
@@ -594,7 +590,7 @@ module Qpid::Proton::Codec
594
590
 
595
591
  # Puts a character value.
596
592
  #
597
- # @param value [Fixnum] The character value.
593
+ # @param value [Integer] The character value.
598
594
  #
599
595
  def char=(value)
600
596
  check(Cproton.pn_data_put_char(@data, value))
@@ -603,7 +599,7 @@ module Qpid::Proton::Codec
603
599
  # If the current node is a character, returns its value. Otherwise,
604
600
  # returns 0.
605
601
  #
606
- # @return [Fixnum] The character value.
602
+ # @return [Integer] The character value.
607
603
  #
608
604
  def char
609
605
  Cproton.pn_data_get_char(@data)
@@ -611,7 +607,7 @@ module Qpid::Proton::Codec
611
607
 
612
608
  # Puts an unsigned long value.
613
609
  #
614
- # @param value [Fixnum] The unsigned long value.
610
+ # @param value [Integer] The unsigned long value.
615
611
  #
616
612
  def ulong=(value)
617
613
  raise TypeError if value.nil?
@@ -622,7 +618,7 @@ module Qpid::Proton::Codec
622
618
  # If the current node is an unsigned long, returns its value. Otherwise,
623
619
  # returns 0.
624
620
  #
625
- # @return [Fixnum] The unsigned long value.
621
+ # @return [Integer] The unsigned long value.
626
622
  #
627
623
  def ulong
628
624
  Cproton.pn_data_get_ulong(@data)
@@ -630,7 +626,7 @@ module Qpid::Proton::Codec
630
626
 
631
627
  # Puts a long value.
632
628
  #
633
- # @param value [Fixnum] The long value.
629
+ # @param value [Integer] The long value.
634
630
  #
635
631
  def long=(value)
636
632
  check(Cproton.pn_data_put_long(@data, value))
@@ -638,14 +634,14 @@ module Qpid::Proton::Codec
638
634
 
639
635
  # If the current node is a long, returns its value. Otherwise, returns 0.
640
636
  #
641
- # @return [Fixnum] The long value.
637
+ # @return [Integer] The long value.
642
638
  def long
643
639
  Cproton.pn_data_get_long(@data)
644
640
  end
645
641
 
646
642
  # Puts a timestamp value.
647
643
  #
648
- # @param value [Fixnum] The timestamp value.
644
+ # @param value [Integer] The timestamp value.
649
645
  #
650
646
  def timestamp=(value)
651
647
  value = value.to_i if (!value.nil? && value.is_a?(Time))
@@ -655,7 +651,7 @@ module Qpid::Proton::Codec
655
651
  # If the current node is a timestamp, returns its value. Otherwise,
656
652
  # returns 0.
657
653
  #
658
- # @return [Fixnum] The timestamp value.
654
+ # @return [Integer] The timestamp value.
659
655
  #
660
656
  def timestamp
661
657
  Cproton.pn_data_get_timestamp(@data)
@@ -697,7 +693,7 @@ module Qpid::Proton::Codec
697
693
 
698
694
  # Puts a decimal32 value.
699
695
  #
700
- # @param value [Fixnum] The decimal32 value.
696
+ # @param value [Integer] The decimal32 value.
701
697
  #
702
698
  def decimal32=(value)
703
699
  check(Cproton.pn_data_put_decimal32(@data, value))
@@ -706,7 +702,7 @@ module Qpid::Proton::Codec
706
702
  # If the current node is a decimal32, returns its value. Otherwise,
707
703
  # returns 0.
708
704
  #
709
- # @return [Fixnum] The decimal32 value.
705
+ # @return [Integer] The decimal32 value.
710
706
  #
711
707
  def decimal32
712
708
  Cproton.pn_data_get_decimal32(@data)
@@ -714,7 +710,7 @@ module Qpid::Proton::Codec
714
710
 
715
711
  # Puts a decimal64 value.
716
712
  #
717
- # @param value [Fixnum] The decimal64 value.
713
+ # @param value [Integer] The decimal64 value.
718
714
  #
719
715
  def decimal64=(value)
720
716
  check(Cproton.pn_data_put_decimal64(@data, value))
@@ -723,7 +719,7 @@ module Qpid::Proton::Codec
723
719
  # If the current node is a decimal64, returns its value. Otherwise,
724
720
  # it returns 0.
725
721
  #
726
- # @return [Fixnum] The decimal64 value.
722
+ # @return [Integer] The decimal64 value.
727
723
  #
728
724
  def decimal64
729
725
  Cproton.pn_data_get_decimal64(@data)
@@ -731,7 +727,7 @@ module Qpid::Proton::Codec
731
727
 
732
728
  # Puts a decimal128 value.
733
729
  #
734
- # @param value [Fixnum] The decimal128 value.
730
+ # @param value [Integer] The decimal128 value.
735
731
  #
736
732
  def decimal128=(value)
737
733
  raise TypeError, "invalid decimal128 value: #{value}" if value.nil?
@@ -744,7 +740,7 @@ module Qpid::Proton::Codec
744
740
  # If the current node is a decimal128, returns its value. Otherwise,
745
741
  # returns 0.
746
742
  #
747
- # @return [Fixnum] The decimal128 value.
743
+ # @return [Integer] The decimal128 value.
748
744
  #
749
745
  def decimal128
750
746
  value = ""
data/lib/codec/mapping.rb CHANGED
@@ -34,7 +34,7 @@ module Qpid::Proton::Codec
34
34
  #
35
35
  # * code - the AMQP code for this type
36
36
  # * name - the AMQP name for this type
37
- # * klasses - the Ruby classes for this type
37
+ # * klasses - native Ruby classes that are mapped to this AMQP type
38
38
  # * getter - overrides the get method for the type
39
39
  def initialize(code, name, klasses = nil, getter = nil)
40
40
 
@@ -77,7 +77,7 @@ module Qpid::Proton::Codec
77
77
  end
78
78
 
79
79
  def self.for_class(klass) # :nodoc:
80
- @@by_class[klass]
80
+ klass and (@@by_class[klass] or self.for_class(klass.superclass))
81
81
  end
82
82
 
83
83
  def self.for_code(code)
@@ -96,7 +96,7 @@ module Qpid::Proton::Codec
96
96
  INT = Mapping.new(Cproton::PN_INT, "int")
97
97
  CHAR = Mapping.new(Cproton::PN_CHAR, "char")
98
98
  ULONG = Mapping.new(Cproton::PN_ULONG, "ulong")
99
- LONG = Mapping.new(Cproton::PN_LONG, "long", [Fixnum, Bignum])
99
+ LONG = Mapping.new(Cproton::PN_LONG, "long", [Integer])
100
100
  TIMESTAMP = Mapping.new(Cproton::PN_TIMESTAMP, "timestamp", [Date, Time])
101
101
  FLOAT = Mapping.new(Cproton::PN_FLOAT, "float")
102
102
  DOUBLE = Mapping.new(Cproton::PN_DOUBLE, "double", [Float])
@@ -19,7 +19,7 @@
19
19
 
20
20
  module Qpid::Proton
21
21
 
22
- # A Connection option has at most one Qpid::Proton::Transport instance.
22
+ # A Connection has at most one Qpid::Proton::Transport instance.
23
23
  #
24
24
  class Connection < Endpoint
25
25
 
@@ -35,6 +35,15 @@ module Qpid::Proton
35
35
  #
36
36
  proton_accessor :hostname
37
37
 
38
+ # @!attribute user
39
+ # The user name for authentication.
40
+ #
41
+ # @return [String] the user name
42
+ proton_accessor :user
43
+
44
+ # @private
45
+ proton_writer :password
46
+
38
47
  # @private
39
48
  proton_reader :attachments
40
49
 
@@ -224,7 +233,7 @@ module Qpid::Proton
224
233
  # @see Endpoint#LOCAL_CLOSED
225
234
  # @see Endpoint#LOCAL_MASK
226
235
  #
227
- # @return [Fixnum] The state flags.
236
+ # @return [Integer] The state flags.
228
237
  #
229
238
  def state
230
239
  Cproton.pn_connection_state(@impl)
@@ -248,7 +257,7 @@ module Qpid::Proton
248
257
  # remote flags, then a match occurs if a*any* of the local or remote flags
249
258
  # are set, respectively.
250
259
  #
251
- # @param mask [Fixnum] The state mask to be matched.
260
+ # @param mask [Integer] The state mask to be matched.
252
261
  #
253
262
  # @return [Session] The first matching session, or nil if none matched.
254
263
  #
@@ -272,7 +281,7 @@ module Qpid::Proton
272
281
  # then a match occurs if *any* of the local ore remote flags are set,
273
282
  # respectively.
274
283
  #
275
- # @param mask [Fixnum] The state mask to be matched.
284
+ # @param mask [Integer] The state mask to be matched.
276
285
  #
277
286
  # @return [Link] The first matching link, or nil if none matched.
278
287
  #
@@ -307,7 +316,7 @@ module Qpid::Proton
307
316
 
308
317
  # Returns the code for a connection error.
309
318
  #
310
- # @return [Fixnum] The error code.
319
+ # @return [Integer] The error code.
311
320
  #
312
321
  def error
313
322
  Cproton.pn_error_code(Cproton.pn_connection_error(@impl))
data/lib/core/delivery.rb CHANGED
@@ -104,7 +104,7 @@ module Qpid::Proton
104
104
 
105
105
  # @!attribute [r] pending
106
106
  #
107
- # @return [Fixnum] Return the amount of pending message data for the
107
+ # @return [Integer] Return the amount of pending message data for the
108
108
  # delivery.
109
109
  #
110
110
  proton_caller :pending
@@ -62,13 +62,13 @@ module Qpid::Proton
62
62
 
63
63
  # @!attribute section_number
64
64
  #
65
- # @return [Fixnum] The section number of the disposition.
65
+ # @return [Integer] The section number of the disposition.
66
66
  #
67
67
  proton_accessor :section_number
68
68
 
69
69
  # @!attribute section_offset
70
70
  #
71
- # @return [Fixnum] The section offset of the disposition.
71
+ # @return [Integer] The section offset of the disposition.
72
72
  #
73
73
  proton_accessor :section_offset
74
74
 
data/lib/core/link.rb CHANGED
@@ -113,7 +113,7 @@ module Qpid::Proton
113
113
  # the link until enough credit is obtained from the receiver to send them
114
114
  # over the wire. In this case the balance reported will go negative.
115
115
  #
116
- # @return [Fixnum] The credit balance.
116
+ # @return [Integer] The credit balance.
117
117
  #
118
118
  # @see #flow
119
119
  #
@@ -130,7 +130,7 @@ module Qpid::Proton
130
130
  # @see #queued
131
131
  # @see #credit
132
132
  #
133
- # @return [Fixnum] The remove view of the credit.
133
+ # @return [Integer] The remove view of the credit.
134
134
  #
135
135
  proton_caller :remote_credit
136
136
 
@@ -142,7 +142,7 @@ module Qpid::Proton
142
142
  # deliveries that might be able to be sent if sufficient credit were issued
143
143
  # by the receiving link endpoint.
144
144
  #
145
- # @return [Fixnum] The available deliveries hint.
145
+ # @return [Integer] The available deliveries hint.
146
146
  #
147
147
  # @see Sender#offered
148
148
  #
@@ -156,7 +156,7 @@ module Qpid::Proton
156
156
  # be insufficient credit to send them to the receiver, or they simply may
157
157
  # not have yet had a chance to be written to the wire.
158
158
  #
159
- # @return [Fixnum] The number of queued deliveries.
159
+ # @return [Integer] The number of queued deliveries.
160
160
  #
161
161
  # @see #credit
162
162
  #
@@ -203,7 +203,7 @@ module Qpid::Proton
203
203
  # When invoked on a Receiver, this operation will return and reset the
204
204
  # number of credits the sender has released back to it.
205
205
  #
206
- # @return [Fixnum] The number of credits drained.
206
+ # @return [Integer] The number of credits drained.
207
207
  #
208
208
  proton_caller :drained
209
209
 
@@ -243,7 +243,7 @@ module Qpid::Proton
243
243
 
244
244
  # Returns the next link that matches the given state mask.
245
245
  #
246
- # @param state_mask [Fixnum] The state mask.
246
+ # @param state_mask [Integer] The state mask.
247
247
  #
248
248
  # @return [Sender, Receiver] The next link.
249
249
  #
@@ -328,7 +328,7 @@ module Qpid::Proton
328
328
 
329
329
  # Sets the local sender settle mode.
330
330
  #
331
- # @param mode [Fixnum] The settle mode.
331
+ # @param mode [Integer] The settle mode.
332
332
  #
333
333
  # @see #SND_UNSETTLED
334
334
  # @see #SND_SETTLED
@@ -340,7 +340,7 @@ module Qpid::Proton
340
340
 
341
341
  # Returns the local sender settle mode.
342
342
  #
343
- # @return [Fixnum] The local sender settle mode.
343
+ # @return [Integer] The local sender settle mode.
344
344
  #
345
345
  # @see #snd_settle_mode
346
346
  #
@@ -350,7 +350,7 @@ module Qpid::Proton
350
350
 
351
351
  # Sets the local receiver settle mode.
352
352
  #
353
- # @param mode [Fixnum] The settle mode.
353
+ # @param mode [Integer] The settle mode.
354
354
  #
355
355
  # @see #RCV_FIRST
356
356
  # @see #RCV_SECOND
@@ -361,7 +361,7 @@ module Qpid::Proton
361
361
 
362
362
  # Returns the local receiver settle mode.
363
363
  #
364
- # @return [Fixnum] The local receiver settle mode.
364
+ # @return [Integer] The local receiver settle mode.
365
365
  #
366
366
  def rcv_settle_mode
367
367
  Cproton.pn_link_rcv_settle_mode(@impl)