Class: KafkaSyrup::Protocol::OffsetResponse::Partition

Inherits:
Struct
  • Object
show all
Defined in:
lib/kafka_syrup/protocol/offset_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/offset_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/offset_response.rb', line 50

def id
  @id
end

#offsetsObject

Returns the value of attribute offsets

Returns:

  • (Object)

    the current value of offsets


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

def offsets
  @offsets
end

Class Method Details

.decode(io) ⇒ Object


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

def self.decode(io)
  new(
    E.read_int32(io),                         # ID
    E.read_int16(io),                         # Error Code
    E.read_array(io, &E.method(:read_int64))  # Offsets
  )
end

Instance Method Details

#encodeObject


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

def encode
  [
    E.write_int32(id),
    E.write_int16(code),
    E.write_array(offsets, &E.method(:write_int64))
  ].join
end