Sha256: e8e94c93951817245d0abadd7ecdacbb3c822f5040ca67c9d082aeae2b56f9fa
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
class Eye::Application attr_reader :groups, :name include Eye::Logger::Helpers def initialize(name, config = {}) @groups = Eye::Utils::AliveArray.new @name = name @logger = Eye::Logger.new(full_name) @config = config debug 'created' end def full_name @name end def update_config(cfg) @config = cfg end def add_group(group) @groups << group end def status_data(debug = false) h = { name: @name, type: :application, subtree: @groups.map{|gr| gr.status_data(debug) }} h.merge!(debug: debug_data) if debug h end def status_data_short h = Hash.new 0 @groups.each do |c| c.processes.each do |p| h[p.state] += 1 end end str = h.sort_by{|a,b| a}.map{|k, v| "#{k}:#{v}" } * ', ' { name: @name, type: :application, state: str} end def debug_data end def send_command(command, *args) debug "send_command #{command} #{args}" @groups.each do |group| group.send_command(command, *args) end end def alive? true # emulate celluloid actor method end def sub_object?(obj) res = @groups.include?(obj) res = @groups.any?{|gr| gr.sub_object?(obj)} if !res res end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eye-0.2 | lib/eye/application.rb |
eye-0.1.11 | lib/eye/application.rb |