Classes
Functions
- Engine()
Engine provides a client-side interface for CodeEngine. Similar object is defined in the client-side library "things.js"
- Program()
Program provides a client-side interface for CodeEngine.
Dispatcher
Kind: global class
- Dispatcher
- new Dispatcher(config, options)
- .runCode(engine_id, code_name, source) ⇒
Promise
- .moveCode(from_id, to_id, code_name, instance_id) ⇒
Promise
- .spawnCode(from_id, to_ids, code_name, instance_id) ⇒
Promise
- .pauseCode(instance_id) ⇒
Promise
- .resumeCode(instance_id) ⇒
Promise
- .killCode(instance_id) ⇒
Promise
- .kill() ⇒
Promise
- .applyActions(actions) ⇒
Promise
- .requestStatusReports() ⇒
undefined
new Dispatcher(config, options)
This object is used to control the CodeEngine instances in the network (i.e. connected to the same Pub/Sub service)
Param | Type | Description |
---|---|---|
config | object |
Configuration for the Dispatcher |
config.pubsub_url | string |
URL of the Pub/Sub server. Defaults to mqtt://localhost |
options | object |
options object for customizing Dispatcher behaviour |
dispatcher.runCode(engine_id, code_name, source) ⇒ Promise
Send command to a CodeEngine to run a program.
Kind: instance method of Dispatcher
Returns: Promise
- - The Promise object returned is resolved when Dispatcher receives acknowledgment from the CodeEngine.
Param | Type | Description |
---|---|---|
engine_id | string |
The ID of the CodeEngine instance |
code_name | string |
Human readable code name (e.g. example.js) |
source | string |
Source code in UTF-8 string |
dispatcher.moveCode(from_id, to_id, code_name, instance_id) ⇒ Promise
[moveCode description]
Kind: instance method of Dispatcher
Returns: Promise
- [description]
Param | Type | Description |
---|---|---|
from_id | String |
[description] |
to_id | String |
[description] |
code_name | String |
[description] |
instance_id | String |
[description] |
dispatcher.spawnCode(from_id, to_ids, code_name, instance_id) ⇒ Promise
[spawnCode description]
Kind: instance method of Dispatcher
Returns: Promise
- [description]
Param | Type | Description |
---|---|---|
from_id | String |
[description] |
to_ids | Array |
[description] |
code_name | String |
[description] |
instance_id | String |
[description] |
dispatcher.pauseCode(instance_id) ⇒ Promise
[pauseCode description]
Kind: instance method of Dispatcher
Returns: Promise
- [description]
Param | Type | Description |
---|---|---|
instance_id | String |
[description] |
dispatcher.resumeCode(instance_id) ⇒ Promise
[resumeCode description]
Kind: instance method of Dispatcher
Returns: Promise
- [description]
Param | Type | Description |
---|---|---|
instance_id | String |
[description] |
dispatcher.killCode(instance_id) ⇒ Promise
[killCode description]
Kind: instance method of Dispatcher
Returns: Promise
- [description]
Param | Type | Description |
---|---|---|
instance_id | String |
[description] |
dispatcher.kill() ⇒ Promise
[kill description]
Kind: instance method of Dispatcher
Returns: Promise
- [description]
dispatcher.applyActions(actions) ⇒ Promise
Apply the given list of actions concurrently
Kind: instance method of Dispatcher
Returns: Promise
- - Promise that resolves when all actions are successful
Param | Type | Description |
---|---|---|
actions | Array |
Array of objects describing actions to perform |
dispatcher.requestStatusReports() ⇒ undefined
Send a Pub/Sub broadcast message to request status reports from all the CodeEngine instances
Kind: instance method of Dispatcher
Returns: undefined
- - Does not return anything, as we cannot know for sure if all CodeEngines have reported.
Engine()
Engine provides a client-side interface for CodeEngine. Similar object is defined in the client-side library "things.js"
Program()
Program provides a client-side interface for CodeEngine.
Kind: global function