Class: EventMachine::Kafka::ConsumerRequest
- Inherits:
-
Object
- Object
- EventMachine::Kafka::ConsumerRequest
- Defined in:
- lib/em-kafka/consumer_request.rb
Instance Method Summary collapse
- #encode ⇒ Object
- #encode_size ⇒ Object
-
#initialize(type, topic, partition, offset, max_size) ⇒ ConsumerRequest
constructor
A new instance of ConsumerRequest.
Constructor Details
#initialize(type, topic, partition, offset, max_size) ⇒ ConsumerRequest
Returns a new instance of ConsumerRequest.
4 5 6 7 |
# File 'lib/em-kafka/consumer_request.rb', line 4 def initialize(type, topic, partition, offset, max_size) @type, @topic, @partition, @offset, @max_size = type, topic, partition, offset, max_size end |
Instance Method Details
#encode ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/em-kafka/consumer_request.rb', line 13 def encode [@type].pack("n") + [@topic.length].pack("n") + @topic + [@partition].pack("N") + [@offset].pack("Q").reverse + # DIY 64bit big endian integer [@max_size].pack("N") end |
#encode_size ⇒ Object
9 10 11 |
# File 'lib/em-kafka/consumer_request.rb', line 9 def encode_size [2 + 2 + @topic.length + 4 + 8 + 4].pack("N") end |