write tasks inside of workers

This commit is contained in:
ansuz
2020-04-16 16:37:24 -04:00
parent ba6faca02e
commit 4e57e390da
4 changed files with 15 additions and 7 deletions

View File

@@ -419,6 +419,10 @@ const runTasks = function (data, cb) {
Env.tasks.runAll(cb);
};
const writeTask = function (data, cb) {
Env.tasks.write(data.time, data.task_command, data.args, cb);
};
const COMMANDS = {
COMPUTE_INDEX: computeIndex,
COMPUTE_METADATA: computeMetadata,
@@ -431,6 +435,7 @@ const COMMANDS = {
GET_HASH_OFFSET: getHashOffset,
REMOVE_OWNED_BLOB: removeOwnedBlob,
RUN_TASKS: runTasks,
WRITE_TASK: writeTask,
};
COMMANDS.INLINE = function (data, cb) {

View File

@@ -323,6 +323,15 @@ Workers.initialize = function (Env, config, _cb) {
}, cb);
};
Env.writeTask = function (time, command, args, cb) {
sendCommand({
command: 'WRITE_TASK',
time: time,
task_command: command,
args: args,
}, cb);
};
// Synchronous crypto functions
Env.validateMessage = function (signedMsg, key, cb) {
sendCommand({