Class: RSwim::Member::HealthState::Base

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

Direct Known Subclasses

Alive, Confirmed, Suspected

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, node_member_id, member_pool, must_propagate:) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
15
# File 'lib/rswim/member/health_state/base.rb', line 9

def initialize(id, node_member_id, member_pool, must_propagate:)
  @member_pool = member_pool
  @id = id
  @node_member_id = node_member_id
  @propagation_count = must_propagate ? -2 : 0
  logger.debug("Member with id #{id} entered new state: #{self.class}")
end

Instance Attribute Details

#propagation_countObject (readonly)

Returns the value of attribute propagation_count.



7
8
9
# File 'lib/rswim/member/health_state/base.rb', line 7

def propagation_count
  @propagation_count
end

Instance Method Details

#advance(_elapsed_seconds) ⇒ Object



21
22
23
# File 'lib/rswim/member/health_state/base.rb', line 21

def advance(_elapsed_seconds)
  self
end

#can_be_pinged?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/rswim/member/health_state/base.rb', line 27

def can_be_pinged?
  false
end

#increment_propagation_countObject



17
18
19
# File 'lib/rswim/member/health_state/base.rb', line 17

def increment_propagation_count
  @propagation_count += 1
end

#member_failed_to_replyObject



25
# File 'lib/rswim/member/health_state/base.rb', line 25

def member_failed_to_reply; end