Class: Nanite::IntermediateMessage

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

Overview

packet that means an intermediate status notification sent from actor to mapper. is appended to a list of messages matching messagekey.

from is sender identity messagekey is a string that can become part of a redis key, which identifies the name under which the message is stored message is arbitrary data that is transferred from actor, an intermediate 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, from, messagekey, message, size = nil) ⇒ IntermediateMessage

Returns a new instance of IntermediateMessage.



252
253
254
255
256
257
258
259
# File 'lib/nanite/packets.rb', line 252

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

Instance Attribute Details

#fromObject

Returns the value of attribute from.



250
251
252
# File 'lib/nanite/packets.rb', line 250

def from
  @from
end

#messageObject

Returns the value of attribute message.



250
251
252
# File 'lib/nanite/packets.rb', line 250

def message
  @message
end

#messagekeyObject

Returns the value of attribute messagekey.



250
251
252
# File 'lib/nanite/packets.rb', line 250

def messagekey
  @messagekey
end

#toObject

Returns the value of attribute to.



250
251
252
# File 'lib/nanite/packets.rb', line 250

def to
  @to
end

#tokenObject

Returns the value of attribute token.



250
251
252
# File 'lib/nanite/packets.rb', line 250

def token
  @token
end

Class Method Details

.json_create(o) ⇒ Object



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

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

Instance Method Details

#to_sObject



266
267
268
# File 'lib/nanite/packets.rb', line 266

def to_s
  "#{super} <#{token}> from #{id_to_s(from)}, key #{messagekey}"
end