Stability: 1 - Experimental
Remotely controlled sandbox for controlling tart-stepping.
Remotely controlled sandbox for controlling tart-stepping. Familiarity with tart-stepping is assumed.
To run the below example run:
npm run readme
"use strict";
var sandbox = require('../index.js');
var tart = require('tart');
var sponsor = tart.minimal();
var create = sponsor(sandbox.createBeh);
var transport = sponsor(function transportBeh(message) {
console.dir(message);
});
var ok = sponsor(function okBeh(message) {
console.dir(message);
});
var fail = sponsor(function failBeh(message) {
console.dir(message);
});
create({fail: fail, ok: ok, transport: transport});
npm test
Public API
- sandbox.createBeh
- sandboxCapabilities.destroy
- sandboxCapabilities.dispatch
- sandboxCapabilities.effect
- sandboxCapabilities.eventLoop
- sandboxCapabilities.sponsor
Actor behavior that will create a new tart-stepping configuration and respond with capabilities allowing for remote control of that configuration.
Message format:
fail
: Actorfunction (error) {}
Fail actor to respond to if errors occur when creating.ok
: Actorfunction (sandboxCapabilities) {}
Ok actor to respond to with created capabilities.transport
: Actorfunction (message) {}
Transport actor capability that will be used for outbound traffic from the created sandbox.
The behavior creates two domains. The controlDomain
, is the control surface for the tart-stepping configuration. The other created domain (domain
) is the actual tart-stepping configuration which will accept commands from the controlDomain
to dispatch, run the event loop, inspect last effect, destroy the configuration, or sponsor new actor behaviors.
sandbox.createBeh
will return a response
object to ok
actor that contains the following:
controlDomain
: String String name for the created control domain.controlReceptionist
: Actorfunction (message) {}
Receptionist actor for the control domain to be registered with a transport for the givencontrolDomain
name.destroy
: URI URI of the capability to destroy the created configuration.dispatch
: URI URI of the capability to dispatch the next event.domain
: String String name for the created domain to be controlled.effect
: URI URI of the capability to inspect the currently queued effects for the configuration.eventLoop
: URI URI of the capability to invoke the event loop on controlled configuration.receptionist
: Actorfunction (message) {}
Receptionist actor for the domain under control to be registered with a transport for the givendomain
.sponsor
: URI URI of the capability to sponsor actor behaviors within the domain under control.
Destroys the sandboxed configuration.
Message format:
ok
: Actor Optional actor to ack after destruction is complete.
Dispatch the next event. This is a wrapper around stepping.dispatch() using tart-adapter message format.
Return the value of stepping.effect
(see tart-stepping).
Message format:
ok
: Actor Actor to receive value ofstepping.effect
.
Dispatch events in a manner provided by control
. This is a wrapper around stepping.eventLoop([control]) using tart-adapter message format.
Given a Node.js module that exports behaviors (see tart-vm), sponsor an actor for each behavior exported from the module.
Message format:
fail
: Actorfunction (error) {}
Fail actor to respond to if errors occur.module
: String Node.js module that exports behaviors that should be sponsored. The resulting actors will be sent took
actor as a map of name-capability URI pairs, or a single capability URI.ok
: Actorfunction (response) {}
Ok actor to respond to with sponsored capability URIs.