class CorosyncCommander::Execution::Message

Attributes

content[RW]
execution_id[R]
recipients[R]
sender[R]
type[RW]

Public Class Methods

from_cpg_message(sender, data) click to toggle source
# File lib/corosync_commander/execution/message.rb, line 12
def self.from_cpg_message(sender, data)
        data = JSON.parse(data)

        recipients = Corosync::CPG::MemberList.new
        data[0].each do |m|
                nodeid,pid = m.split(':').map{|i| i.to_i}
                recipients << Corosync::CPG::Member.new(nodeid,pid)
        end

        execution_id = data[1]

        type = data[2]

        content = data[3]

        self.new(:sender => sender, :recipients => recipients, :execution_id => execution_id, :type => type, :content => content)
end
new(params = {}) click to toggle source
# File lib/corosync_commander/execution/message.rb, line 30
def initialize(params = {})
        @sender = params[:sender]
        @recipients = Corosync::CPG::MemberList.new(params[:recipients])
        @execution_id = params[:execution_id]
        @type = params[:type]
        @content = params[:content]
end

Public Instance Methods

reply(content) click to toggle source
# File lib/corosync_commander/execution/message.rb, line 38
def reply(content)
        self.class.new(:recipients => [@sender], :execution_id => @execution_id, :type => 'response', :content => content)
end
to_s() click to toggle source
# File lib/corosync_commander/execution/message.rb, line 42
def to_s
        [@recipients.to_a, @execution_id, @type, @content].to_json
end