Class: DRbQS::NodeList
- Inherits:
-
Object
- Object
- DRbQS::NodeList
- Defined in:
- lib/drbqs/node_list.rb
Instance Attribute Summary collapse
-
#history ⇒ Object
readonly
Returns the value of attribute history.
Instance Method Summary collapse
- #delete(id) ⇒ Object
- #delete_not_alive ⇒ Object
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
- #get_new_id(id_str) ⇒ Object
-
#initialize ⇒ NodeList
constructor
A new instance of NodeList.
- #set_alive(id) ⇒ Object
- #set_check_connection ⇒ Object
Constructor Details
Instance Attribute Details
#history ⇒ Object (readonly)
Returns the value of attribute history.
5 6 7 |
# File 'lib/drbqs/node_list.rb', line 5 def history @history end |
Instance Method Details
#delete(id) ⇒ Object
29 30 31 32 |
# File 'lib/drbqs/node_list.rb', line 29 def delete(id) @list.delete(id) @history.set(id, :disconnect) end |
#delete_not_alive ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/drbqs/node_list.rb', line 34 def delete_not_alive @check.each do |id| delete(id) end deleted = @check @check = [] deleted end |
#each(&block) ⇒ Object
21 22 23 |
# File 'lib/drbqs/node_list.rb', line 21 def each(&block) @list.each(&block) end |
#empty? ⇒ Boolean
47 48 49 |
# File 'lib/drbqs/node_list.rb', line 47 def empty? @list.size == 0 end |
#get_new_id(id_str) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/drbqs/node_list.rb', line 14 def get_new_id(id_str) @id += 1 @list[@id] = id_str @history.set(@id, :connect, @list[@id]) @id end |
#set_alive(id) ⇒ Object
43 44 45 |
# File 'lib/drbqs/node_list.rb', line 43 def set_alive(id) @check.delete(id) end |
#set_check_connection ⇒ Object
25 26 27 |
# File 'lib/drbqs/node_list.rb', line 25 def set_check_connection @check = @list.keys end |