distributed_dart library
Properties
bool logging #
Set to true
for enabling debug output from the distributed_dart library.
Default value is false
.
bool logging = false
Functions
void registerNode(NodeAddress node, [bool allowremote = false, String workdir]) #
void registerNode(NodeAddress node, [bool allowremote=false, String workdir]) { //kregisterNode must not be called more than once if(NodeAddress._localhost != null) { throw new UnsupportedOperationError("Can only register node once"); } // set local identification NodeAddress._localhost = node; // set path to where to store received files _workDirPath = (workdir == null) ? _getDefaultWorkDir() : workdir; // setup requesthandlers _RequestHandler.allow(_NETWORK_FILE_HANDLER); _RequestHandler.allow(_NETWORK_FILE_REQUEST_HANDLER); _RequestHandler.allow(_NETWORK_ISOLATE_DATA_HANDLER); if(allowremote){ _RequestHandler.allow(_NETWORK_SPAWN_ISOLATE_HANDLER); _RequestHandler.allow(_NETWORK_SPAWN_RESPONSE_HANDLER); } // start listening for incomming requests _Network._initServer(); }
SendPort spawnUriRemote(String uri, NodeAddress node) #
SendPort spawnUriRemote(String uri, NodeAddress node){ var requestId = new _IsolateId(); var rp = new ReceivePort(); var buffer = new StreamController(); rp.receive((msg,reply) => buffer.sink.add({'msg':msg,'reply':reply})); _RemoteProxy .subscribe(requestId) .then((_RemoteSendPort rsp){ buffer.stream.listen((data){ var msg = data['msg']; var sp = data['reply']; var local = new _LocalIsolate(sp); rsp.send(msg, local.toRemoteSendPort()); }); }); _DartCodeDb.resolveDartProgram(uri).then((_DartProgram dp){ new _spawnIsolateRequest(requestId,dp).sendTo(node); }); return rp.toSendPort(); }