Class: Pulsar::MessageId
- Inherits:
-
Object
- Object
- Pulsar::MessageId
- Includes:
- Comparable
- Defined in:
- lib/pulsar/message_id.rb
Overview
Comparable Pulsar message identifier.
Instance Attribute Summary collapse
-
#batch_index ⇒ Object
readonly
Returns the value of attribute batch_index.
-
#entry_id ⇒ Object
readonly
Returns the value of attribute entry_id.
-
#ledger_id ⇒ Object
readonly
Returns the value of attribute ledger_id.
-
#partition_index ⇒ Object
readonly
Returns the value of attribute partition_index.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(ledger_id:, entry_id:, partition_index: -1,, batch_index: -1)) ⇒ MessageId
constructor
A new instance of MessageId.
- #inspect ⇒ Object
Constructor Details
#initialize(ledger_id:, entry_id:, partition_index: -1,, batch_index: -1)) ⇒ MessageId
Returns a new instance of MessageId.
10 11 12 13 14 15 16 |
# File 'lib/pulsar/message_id.rb', line 10 def initialize(ledger_id:, entry_id:, partition_index: -1, batch_index: -1) @ledger_id = Integer(ledger_id) @entry_id = Integer(entry_id) @partition_index = Integer(partition_index) @batch_index = Integer(batch_index) freeze end |
Instance Attribute Details
#batch_index ⇒ Object (readonly)
Returns the value of attribute batch_index.
8 9 10 |
# File 'lib/pulsar/message_id.rb', line 8 def batch_index @batch_index end |
#entry_id ⇒ Object (readonly)
Returns the value of attribute entry_id.
8 9 10 |
# File 'lib/pulsar/message_id.rb', line 8 def entry_id @entry_id end |
#ledger_id ⇒ Object (readonly)
Returns the value of attribute ledger_id.
8 9 10 |
# File 'lib/pulsar/message_id.rb', line 8 def ledger_id @ledger_id end |
#partition_index ⇒ Object (readonly)
Returns the value of attribute partition_index.
8 9 10 |
# File 'lib/pulsar/message_id.rb', line 8 def partition_index @partition_index end |
Instance Method Details
#<=>(other) ⇒ Object
18 19 20 21 22 |
# File 'lib/pulsar/message_id.rb', line 18 def <=>(other) return nil unless other.is_a?(MessageId) to_a <=> other.to_a end |
#eql?(other) ⇒ Boolean
24 25 26 |
# File 'lib/pulsar/message_id.rb', line 24 def eql?(other) other.is_a?(MessageId) && to_a == other.to_a end |
#hash ⇒ Object
28 29 30 |
# File 'lib/pulsar/message_id.rb', line 28 def hash to_a.hash end |
#inspect ⇒ Object
32 33 34 35 |
# File 'lib/pulsar/message_id.rb', line 32 def inspect "#<#{self.class.name} ledger_id=#{ledger_id} entry_id=#{entry_id} " \ "partition_index=#{partition_index} batch_index=#{batch_index}>" end |