Class: KafkaSyrup::Protocol::MetadataResponse::Broker

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostObject

Returns the value of attribute host

Returns:

  • (Object)

    the current value of host



40
41
42
# File 'lib/kafka_syrup/protocol/metadata_response.rb', line 40

def host
  @host
end

#nodeObject

Returns the value of attribute node

Returns:

  • (Object)

    the current value of node



40
41
42
# File 'lib/kafka_syrup/protocol/metadata_response.rb', line 40

def node
  @node
end

#portObject

Returns the value of attribute port

Returns:

  • (Object)

    the current value of port



40
41
42
# File 'lib/kafka_syrup/protocol/metadata_response.rb', line 40

def port
  @port
end

Class Method Details

.decode(io) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/kafka_syrup/protocol/metadata_response.rb', line 49

def self.decode(io)
  new(
    E.read_int32(io),   # Node
    E.read_string(io),  # Host
    E.read_int32(io)    # Port
  )
end

Instance Method Details

#encodeObject



41
42
43
44
45
46
47
# File 'lib/kafka_syrup/protocol/metadata_response.rb', line 41

def encode
  [
    E.write_int32(node),
    E.write_string(host),
    E.write_int32(port)
  ].join
end