Class: DRbQS::ProcessList::Node
Instance Method Summary
collapse
#initialize, #server_of_key_exist?
Instance Method Details
#clear_process_not_exist ⇒ Object
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
# File 'lib/drbqs/config/process_list.rb', line 163
def clear_process_not_exist
server = Hash.new do |h, k|
h[k] = Array.new
end
list.each do |pid, data|
if DRbQS::Misc.process_running_normally?(pid)
server[data[:uri]] << pid
else
delete(pid)
end
end
server.each do |server_uri, pid_ary|
unless DRbQS::Manage.new(:uri => server_uri).server_respond?
pid_ary.each do |pid|
delete(pid)
end
end
end
end
|
#delete(pid) ⇒ Object
159
160
161
|
# File 'lib/drbqs/config/process_list.rb', line 159
def delete(pid)
delete_file(pid_to_file(pid))
end
|
#get(pid) ⇒ Object
155
156
157
|
# File 'lib/drbqs/config/process_list.rb', line 155
def get(pid)
load_file(pid_to_file(pid))
end
|
#list ⇒ Object
139
140
141
142
143
144
145
|
# File 'lib/drbqs/config/process_list.rb', line 139
def list
h = {}
entries.each do |file|
h[file_to_pid(file)] = load_file(file)
end
h
end
|
#save(pid, data) ⇒ Object
If file exists then this method overwrites the file.
148
149
150
151
152
153
|
# File 'lib/drbqs/config/process_list.rb', line 148
def save(pid, data)
unless save_file(pid_to_file(pid), data)
delete(pid)
save(pid, data)
end
end
|