Class: DRbQS::ProcessList::Server

Inherits:
ListDirectory show all
Defined in:
lib/drbqs/config/process_list.rb

Instance Method Summary collapse

Methods inherited from ListDirectory

#initialize, #server_of_key_exist?

Constructor Details

This class inherits a constructor from DRbQS::ProcessList::ListDirectory

Instance Method Details

#clear_process_not_existObject



119
120
121
122
123
124
125
# File 'lib/drbqs/config/process_list.rb', line 119

def clear_process_not_exist
  list.each do |uri, data|
    if !DRbQS::Misc.process_running_normally?(data[:pid]) || !DRbQS::Manage.new(:uri => uri).server_respond?
      delete(uri)
    end
  end
end

#delete(uri) ⇒ Object



115
116
117
# File 'lib/drbqs/config/process_list.rb', line 115

def delete(uri)
  delete_file(uri_to_file(uri))
end

#get(uri) ⇒ Object



111
112
113
# File 'lib/drbqs/config/process_list.rb', line 111

def get(uri)
  load_file(uri_to_file(uri))
end

#listObject



95
96
97
98
99
100
101
# File 'lib/drbqs/config/process_list.rb', line 95

def list
  h = {}
  entries.each do |file|
    h[file_to_uri(file)] = load_file(file)
  end
  h
end

#save(uri, data) ⇒ Object

If file exists then this method overwrites the file.



104
105
106
107
108
109
# File 'lib/drbqs/config/process_list.rb', line 104

def save(uri, data)
  unless save_file(uri_to_file(uri), data)
    delete(uri)
    save(uri, data)
  end
end