Class: Deimos::Utils::LagReporter::ConsumerGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/deimos/utils/lag_reporter.rb

Overview

Class that has a list of topics

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ ConsumerGroup

Returns a new instance of ConsumerGroup.

Parameters:

  • id (String)


20
21
22
23
# File 'lib/deimos/utils/lag_reporter.rb', line 20

def initialize(id)
  self.id = id
  self.topics = {}
end

Instance Attribute Details

#idString

Returns:

  • (String)


17
18
19
# File 'lib/deimos/utils/lag_reporter.rb', line 17

def id
  @id
end

#topicsHash<String, Topic>

Returns:



15
16
17
# File 'lib/deimos/utils/lag_reporter.rb', line 15

def topics
  @topics
end

Instance Method Details

#assign_current_offset(topic, partition, offset) ⇒ Object

Parameters:

  • topic (String)
  • partition (Integer)
  • offset (Integer)


35
36
37
38
# File 'lib/deimos/utils/lag_reporter.rb', line 35

def assign_current_offset(topic, partition, offset)
  self.topics[topic.to_s] ||= Topic.new(topic, self)
  self.topics[topic.to_s].assign_current_offset(partition, offset)
end

#report_lag(topic, partition) ⇒ Object

Parameters:

  • topic (String)
  • partition (Integer)


27
28
29
30
# File 'lib/deimos/utils/lag_reporter.rb', line 27

def report_lag(topic, partition)
  self.topics[topic.to_s] ||= Topic.new(topic, self)
  self.topics[topic.to_s].report_lag(partition)
end