Class: Nanite::Register

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

Overview

packet that means an availability notification sent from actor to mapper

from is sender identity services is a list of services provided by the node status is a load of the node by default, but may be any criteria

agent may use to report it's availability, load, etc

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(identity, services, status, tags, size = nil) ⇒ Register

Returns a new instance of Register.



326
327
328
329
330
331
332
# File 'lib/nanite/packets.rb', line 326

def initialize(identity, services, status, tags, size=nil)
  @status   = status
  @tags     = tags
  @identity = identity
  @services = services
  @size     = size
end

Instance Attribute Details

#identityObject

Returns the value of attribute identity.



324
325
326
# File 'lib/nanite/packets.rb', line 324

def identity
  @identity
end

#servicesObject

Returns the value of attribute services.



324
325
326
# File 'lib/nanite/packets.rb', line 324

def services
  @services
end

#statusObject

Returns the value of attribute status.



324
325
326
# File 'lib/nanite/packets.rb', line 324

def status
  @status
end

#tagsObject

Returns the value of attribute tags.



324
325
326
# File 'lib/nanite/packets.rb', line 324

def tags
  @tags
end

Class Method Details

.json_create(o) ⇒ Object



334
335
336
337
# File 'lib/nanite/packets.rb', line 334

def self.json_create(o)
  i = o['data']
  new(i['identity'], i['services'], i['status'], i['tags'], o['size'])
end

Instance Method Details

#to_sObject



339
340
341
342
343
344
# File 'lib/nanite/packets.rb', line 339

def to_s
  log_msg = "#{super} #{id_to_s(identity)}"
  log_msg += ", services: #{services.join(', ')}" if services && !services.empty?
  log_msg += ", tags: #{tags.join(', ')}" if tags && !tags.empty?
  log_msg
end