Class: KafkaSyrup::Protocol::ProduceResponse::Partition

Inherits:
Struct
  • Object
show all
Defined in:
lib/kafka_syrup/protocol/produce_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



50
51
52
# File 'lib/kafka_syrup/protocol/produce_response.rb', line 50

def code
  @code
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



50
51
52
# File 'lib/kafka_syrup/protocol/produce_response.rb', line 50

def id
  @id
end

#offsetObject

Returns the value of attribute offset

Returns:

  • (Object)

    the current value of offset



50
51
52
# File 'lib/kafka_syrup/protocol/produce_response.rb', line 50

def offset
  @offset
end

Class Method Details

.decode(io) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/kafka_syrup/protocol/produce_response.rb', line 59

def self.decode(io)
  new(
    E.read_int32(io), # ID
    E.read_int16(io), # Code
    E.read_int64(io)  # Offset
  )
end

Instance Method Details

#encodeObject



51
52
53
54
55
56
57
# File 'lib/kafka_syrup/protocol/produce_response.rb', line 51

def encode
  [
    E.write_int32(id),
    E.write_int16(code),
    E.write_int64(offset)
  ].join
end