Class: Isono::NodeModules::NodeCollector

Inherits:
Base
  • Object
show all
Includes:
Logger
Defined in:
lib/isono/node_modules/node_collector.rb

Instance Attribute Summary

Attributes inherited from Base

#node

Instance Method Summary collapse

Methods included from Logger

included, initialize

Methods inherited from Base

#config_section, #initialize, #manifest, #value_object

Constructor Details

This class inherits a constructor from Isono::NodeModules::Base

Instance Method Details

#listObject



68
69
70
# File 'lib/isono/node_modules/node_collector.rb', line 68

def list
  Models::NodeState.dataset.all.map{|r| r.values }
end

#notify(node_id, boot_token) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/isono/node_modules/node_collector.rb', line 72

def notify(node_id, boot_token)
  event = EventChannel.new(node)
  
  a = Models::NodeState.find(:node_id=>node_id) || Models::NodeState.new(:node_id=>node_id)
  a.process_event(:on_ping)
  if a.new?
    a.boot_token = boot_token
    a.save
    event.publish('node_collector/monitored', :args=>[a.values])
  else
    a.save_changes
    #event.publish('node_collector/pong')
  end
end