Class: RSwim::Member::HealthState::Confirmed

Inherits:
Base
  • Object
show all
Defined in:
lib/rswim/member/health_state/confirmed.rb

Instance Attribute Summary

Attributes inherited from Base

#propagation_count

Instance Method Summary collapse

Methods inherited from Base

#can_be_pinged?, #increment_propagation_count, #member_failed_to_reply

Constructor Details

#initialize(id, node_member_id, member_pool, must_propagate: false) ⇒ Confirmed

Returns a new instance of Confirmed.



7
8
9
10
11
12
# File 'lib/rswim/member/health_state/confirmed.rb', line 7

def initialize(id, node_member_id, member_pool, must_propagate: false)
  super
  @member_halted = false
  @member_removed = false
  @life_time_seconds = 0
end

Instance Method Details

#advance(elapsed_seconds) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rswim/member/health_state/confirmed.rb', line 14

def advance(elapsed_seconds)
  @life_time_seconds += elapsed_seconds
  unless @member_halted
    @member_pool.halt_member(@id)
    @member_halted = true
  end

  if !@member_removed && @life_time_seconds > 10
    @member_pool.remove_member(@id)
    @member_removed = true
  end

  self
end

#statusObject



33
34
35
# File 'lib/rswim/member/health_state/confirmed.rb', line 33

def status
  :confirmed
end

#update_suspicion(_status, _old_incarnation_number, _gossip_incarnation_number) ⇒ Object



29
30
31
# File 'lib/rswim/member/health_state/confirmed.rb', line 29

def update_suspicion(_status, _old_incarnation_number, _gossip_incarnation_number)
  self
end