function message(dest, body) {
return {
dest: dest,
body: body
};
}
function register(name, fn, scp, remote) {
if (flxRepo[name] && !options.allowFlxOverwrite)
return false;
if (typeof fn === 'function') {
scp = scp || {};
scp.m = message;
var flx = {run: fn, scp: scp, minion: remote};
if(remote) {
if (!minions[remote]) minions[remote] = {name: remote, flx:{}};
minions[remote].flx[name] = flx;
}
flxRepo[name] = flx;
return true;
}
return false;
}
function receive(req) {
function _receiveOne(dest) {
if (!flxRepo[dest]) {
throw 'flx ' + dest + ' is not defined';
}
if (flxRepo[dest].minion && flxRepo[dest].minion.worker) {