Class: Nanite::Result

Inherits:
Packet show all
Defined in:
lib/nanite/packets.rb

Overview

packet that means a work result notification sent from actor to mapper

from is sender identity results is arbitrary data that is transferred from actor, a result of actor’s work token is a generated request id that mapper uses to identify replies to is identity of the node result should be delivered to

Instance Attribute Summary collapse

Attributes inherited from Packet

#size

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Packet

#id_to_s, #to_json

Constructor Details

#initialize(token, to, results, from, size = nil) ⇒ Result

Returns a new instance of Result.



264
265
266
267
268
269
270
# File 'lib/nanite/packets.rb', line 264

def initialize(token, to, results, from, size=nil)
  @token = token
  @to = to
  @from = from
  @results = results
  @size = size
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



262
263
264
# File 'lib/nanite/packets.rb', line 262

def from
  @from
end

#resultsObject

Returns the value of attribute results.



262
263
264
# File 'lib/nanite/packets.rb', line 262

def results
  @results
end

#toObject

Returns the value of attribute to.



262
263
264
# File 'lib/nanite/packets.rb', line 262

def to
  @to
end

#tokenObject

Returns the value of attribute token.



262
263
264
# File 'lib/nanite/packets.rb', line 262

def token
  @token
end

Class Method Details

.json_create(o) ⇒ Object



272
273
274
275
# File 'lib/nanite/packets.rb', line 272

def self.json_create(o)
  i = o['data']
  new(i['token'], i['to'], i['results'], i['from'], o['size'])
end

Instance Method Details

#to_s(filter = nil) ⇒ Object



277
278
279
280
281
282
283
# File 'lib/nanite/packets.rb', line 277

def to_s(filter=nil)
  log_msg = "#{super} <#{token}>"
  log_msg += " from #{id_to_s(from)}" if filter.nil? || filter.include?(:from)
  log_msg += " to #{id_to_s(to)}" if filter.nil? || filter.include?(:to)
  log_msg += " results: #{results.inspect}" if filter.nil? || filter.include?(:results)
  log_msg
end