Class: KafkaRest::Partition
- Inherits:
-
Object
- Object
- KafkaRest::Partition
- Includes:
- Producable
- Defined in:
- lib/kafka_rest/partition.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#topic ⇒ Object
readonly
Returns the value of attribute topic.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(client, topic, id, raw = EMPTY_STRING) ⇒ Partition
constructor
A new instance of Partition.
- #to_s ⇒ Object
Methods included from Producable
Constructor Details
#initialize(client, topic, id, raw = EMPTY_STRING) ⇒ Partition
Returns a new instance of Partition.
7 8 9 10 11 12 |
# File 'lib/kafka_rest/partition.rb', line 7 def initialize(client, topic, id, raw = EMPTY_STRING) @client = client @topic = topic @id = id @raw = raw end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/kafka_rest/partition.rb', line 5 def client @client end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/kafka_rest/partition.rb', line 5 def id @id end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
5 6 7 |
# File 'lib/kafka_rest/partition.rb', line 5 def raw @raw end |
#topic ⇒ Object (readonly)
Returns the value of attribute topic.
5 6 7 |
# File 'lib/kafka_rest/partition.rb', line 5 def topic @topic end |
Instance Method Details
#get ⇒ Object
14 15 16 |
# File 'lib/kafka_rest/partition.rb', line 14 def get client.request(partition_path).tap { |res| @raw = res } end |
#to_s ⇒ Object
18 19 20 21 22 23 |
# File 'lib/kafka_rest/partition.rb', line 18 def to_s res = "Partition{topic=\"#{topic.name}\", id=#{id}".freeze res += ", leader=#{raw['leader']}".freeze unless raw.empty? res += ", replicas=#{raw['replicas'].size}".freeze unless raw.empty? res += RIGHT_BRACE end |