Class: DRbQS::Manage::SendSignal

Inherits:
Object
  • Object
show all
Defined in:
lib/drbqs/manage/send_signal.rb

Constant Summary collapse

MAX_WAIT_TIME =
10

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ SendSignal

Returns a new instance of SendSignal.



6
7
8
# File 'lib/drbqs/manage/send_signal.rb', line 6

def initialize(message)
  @message = message
end

Instance Method Details

#get_historyObject



63
64
65
66
67
68
69
# File 'lib/drbqs/manage/send_signal.rb', line 63

def get_history
  send_signal_to_server(:request_history, sender_id)
  if mes = wait_response([:history, String])
    return mes[1]
  end
  nil
end

#get_responseObject



71
72
73
74
75
76
77
# File 'lib/drbqs/manage/send_signal.rb', line 71

def get_response
  send_signal_to_server(:request_response, [sender_id, Time.now])
  if mes = wait_response([:response, sender_id, nil])
    return true
  end
  nil
end

#get_statusObject



55
56
57
58
59
60
61
# File 'lib/drbqs/manage/send_signal.rb', line 55

def get_status
  send_signal_to_server(:request_status, sender_id)
  if mes = wait_response([:status, String])
    return mes[1]
  end
  nil
end

#send_data(data) ⇒ Object



35
36
37
# File 'lib/drbqs/manage/send_signal.rb', line 35

def send_data(data)
  send_signal_to_server(:new_data, data)
end

#send_exit_signalObject



19
20
21
# File 'lib/drbqs/manage/send_signal.rb', line 19

def send_exit_signal
  send_signal_to_server(:exit_server, sender_id)
end

#send_node_exit_after_task(node_id) ⇒ Object



23
24
25
# File 'lib/drbqs/manage/send_signal.rb', line 23

def send_node_exit_after_task(node_id)
  send_signal_to_server(:exit_after_task, node_id)
end

#send_node_sleep(node_id) ⇒ Object



31
32
33
# File 'lib/drbqs/manage/send_signal.rb', line 31

def send_node_sleep(node_id)
  send_signal_to_server(:sleep_node, node_id)
end

#send_node_wake(node_id) ⇒ Object



27
28
29
# File 'lib/drbqs/manage/send_signal.rb', line 27

def send_node_wake(node_id)
  send_signal_to_server(:wake_node, node_id)
end

#sender_idObject



10
11
12
# File 'lib/drbqs/manage/send_signal.rb', line 10

def sender_id
  "#{Socket.gethostname}/#{Process.pid}"
end