This repository has been archived by the owner on May 29, 2021. It is now read-only.
Implement dependency injection into workers, resolves #203 #211
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A new skale context method
sc.require
is added. It specifies aset of modules on user side (master) which have to be deployed in
workers for use by callbacks, such as mappers, reducers, etc.
Under the hood, browserify is used on master side to build a
bundle which is serialized and sent to workers (as part of task).
It is then evaluated in worker global context, and dependencies
remain persistent as long as workers live.
This method allows to use in workers any javascript module which
can be browserified, so a large number (almost any pure JS package).
The current commit is for local version, not distributed (code will
be exactly the same). It is experimental for the moment.
An additional statement
sc.bundle
could be added as well to injectpre-compiled modules, avoiding the penalty of
browserify
at eachrun.