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.



219
220
221
222
223
224
225
# File 'lib/nanite/packets.rb', line 219

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.



217
218
219
# File 'lib/nanite/packets.rb', line 217

def from
  @from
end

#resultsObject

Returns the value of attribute results.



217
218
219
# File 'lib/nanite/packets.rb', line 217

def results
  @results
end

#toObject

Returns the value of attribute to.



217
218
219
# File 'lib/nanite/packets.rb', line 217

def to
  @to
end

#tokenObject

Returns the value of attribute token.



217
218
219
# File 'lib/nanite/packets.rb', line 217

def token
  @token
end

Class Method Details

.json_create(o) ⇒ Object



227
228
229
230
# File 'lib/nanite/packets.rb', line 227

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



232
233
234
235
236
237
238
# File 'lib/nanite/packets.rb', line 232

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