Class: Kafkat::Partition

Inherits:
Struct
  • Object
show all
Defined in:
lib/kafkat/cluster/partition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



2
3
4
# File 'lib/kafkat/cluster/partition.rb', line 2

def id
  @id
end

#isrObject

Returns the value of attribute isr

Returns:

  • (Object)

    the current value of isr



2
3
4
# File 'lib/kafkat/cluster/partition.rb', line 2

def isr
  @isr
end

#leaderObject

Returns the value of attribute leader

Returns:

  • (Object)

    the current value of leader



2
3
4
# File 'lib/kafkat/cluster/partition.rb', line 2

def leader
  @leader
end

#replicasObject

Returns the value of attribute replicas

Returns:

  • (Object)

    the current value of replicas



2
3
4
# File 'lib/kafkat/cluster/partition.rb', line 2

def replicas
  @replicas
end

#topic_nameObject

Returns the value of attribute topic_name

Returns:

  • (Object)

    the current value of topic_name



2
3
4
# File 'lib/kafkat/cluster/partition.rb', line 2

def topic_name
  @topic_name
end

Instance Method Details

#has_leader?(brokers) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/kafkat/cluster/partition.rb', line 3

def has_leader?(brokers)
  leader && leader != -1 && brokers.include?(leader)
end

#under_replicated?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/kafkat/cluster/partition.rb', line 7

def under_replicated?
  isr.size < replicas.size
end