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.



297
298
299
300
301
302
303
304
# File 'lib/nanite/packets.rb', line 297

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.



295
296
297
# File 'lib/nanite/packets.rb', line 295

def from
  @from
end

#messageObject

Returns the value of attribute message.



295
296
297
# File 'lib/nanite/packets.rb', line 295

def message
  @message
end

#messagekeyObject

Returns the value of attribute messagekey.



295
296
297
# File 'lib/nanite/packets.rb', line 295

def messagekey
  @messagekey
end

#toObject

Returns the value of attribute to.



295
296
297
# File 'lib/nanite/packets.rb', line 295

def to
  @to
end

#tokenObject

Returns the value of attribute token.



295
296
297
# File 'lib/nanite/packets.rb', line 295

def token
  @token
end

Class Method Details

.json_create(o) ⇒ Object



306
307
308
309
# File 'lib/nanite/packets.rb', line 306

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



311
312
313
# File 'lib/nanite/packets.rb', line 311

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