Class: LS4::HeartbeatServerService

Inherits:
Service show all
Defined in:
lib/ls4/service/heartbeat.rb

Instance Method Summary collapse

Methods inherited from Service

init

Methods included from EventBus::SingletonMixin

#ebus_bind!, #ebus_connect, extended

Methods included from EventBus::BusMixin

#ebus_all_slots, #ebus_disconnect!

Methods included from EventBus::DeclarerBase::Methods

#connect, #ebus_all_slots, #ebus_call_log, #ebus_call_slots, #ebus_signal_error, #ebus_signal_log, #ebus_signal_slots

Methods included from EventBus::DeclarerBase

#call_slot, #signal_slot

Constructor Details

#initializeHeartbeatServerService

Returns a new instance of HeartbeatServerService.



43
44
45
46
# File 'lib/ls4/service/heartbeat.rb', line 43

def initialize
  super
  @syncs = []
end

Instance Method Details

#rpc_heartbeat(nid, sync_hash) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ls4/service/heartbeat.rb', line 48

def rpc_heartbeat(nid, sync_hash)
  hbres = HeartbeatResponse.new

  if nid
    hbres.term = MembershipBus.reset_fault_detector(nid)
  end

  if sync_hash
    if SyncBus.check_hash(sync_hash)
      hbres.sync_needed = false
    else
      hbres.sync_needed = true
    end
  end

  hbres
end