Class: Nanite::Push
Overview
packet that means a work push from mapper to actor node
type is a service name payload is arbitrary data that is transferred from mapper to actor
Options: from is sender identity token is a generated request id that mapper uses to identify replies selector is the selector used to route the request target is the target nanite for the request persistent signifies if this request should be saved to persistent storage by the AMQP broker
Constant Summary collapse
- DEFAULT_OPTIONS =
{:selector => :least_loaded}
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#persistent ⇒ Object
Returns the value of attribute persistent.
-
#selector ⇒ Object
Returns the value of attribute selector.
-
#target ⇒ Object
Returns the value of attribute target.
-
#token ⇒ Object
Returns the value of attribute token.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, payload, opts = {}) ⇒ Push
constructor
A new instance of Push.
Methods inherited from Packet
Constructor Details
#initialize(type, payload, opts = {}) ⇒ Push
Returns a new instance of Push.
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/nanite/packets.rb', line 109 def initialize(type, payload, opts={}) opts = DEFAULT_OPTIONS.merge(opts) @type = type @payload = payload @from = opts[:from] @token = opts[:token] @selector = opts[:selector] @target = opts[:target] @persistent = opts[:persistent] end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
107 108 109 |
# File 'lib/nanite/packets.rb', line 107 def from @from end |
#payload ⇒ Object
Returns the value of attribute payload.
107 108 109 |
# File 'lib/nanite/packets.rb', line 107 def payload @payload end |
#persistent ⇒ Object
Returns the value of attribute persistent.
107 108 109 |
# File 'lib/nanite/packets.rb', line 107 def persistent @persistent end |
#selector ⇒ Object
Returns the value of attribute selector.
107 108 109 |
# File 'lib/nanite/packets.rb', line 107 def selector @selector end |
#target ⇒ Object
Returns the value of attribute target.
107 108 109 |
# File 'lib/nanite/packets.rb', line 107 def target @target end |
#token ⇒ Object
Returns the value of attribute token.
107 108 109 |
# File 'lib/nanite/packets.rb', line 107 def token @token end |
#type ⇒ Object
Returns the value of attribute type.
107 108 109 |
# File 'lib/nanite/packets.rb', line 107 def type @type end |
Class Method Details
.json_create(o) ⇒ Object
119 120 121 122 123 |
# File 'lib/nanite/packets.rb', line 119 def self.json_create(o) i = o['data'] new(i['type'], i['payload'], {:from => i['from'], :token => i['token'], :selector => i['selector'], :target => i['target'], :persistent => i['persistent']}) end |