Class: Sandbox

Sandbox

All executions in the system happen within a Sandbox. Every map and reduce function is executed here. All environment initializations also happen within the sandbox. It holds the custom scope that every function is supposed to run on. Also, the stream logger is set as a utility for the sandbox.

Constructor

new Sandbox()

Source:

Methods

cleanSandbox()

Function to clean and reset the Sandbox
Source:

executeMapFunction(finalCallback)

Trigger to execute the Map Function
Parameters:
Name Type Description
finalCallback function Callback called at the end of the Map Function execution. Returns err and results
Source:

executeReduceFunction(err, results, finalCallback)

Trigger to execute the Reduce Function
Parameters:
Name Type Description
err object The error object.
results object The results object.
finalCallback function Callback called at the end of the Reduce Function execution.
Source:

getSandboxEmitData() → {JSON}

Getter to get the data which will be emitted to other sockets
Source:
Returns:
data The data that needs to be emitted. The Map, Reduce and the Scope
Type
JSON

initializeEnvironment(data, finalCallback)

Function to initialize Sandbox for executing remote procedures
Parameters:
Name Type Description
data JSON The data object that contains the map and reduce functions along with scope.
finalCallback function The final callback to be called.
Source:

initializeParallelSandbox(map, reduce, scope)

Function to initialize Sandbox for the Parallel functionality, which does not contain an array.
Parameters:
Name Type Description
map function The map function that has to be executed
reduce function The reduce function that has to be executed on the server
scope JSON The custom scope that each function needs to be run on
Source:

initializeSandbox(map, reduce, scope)

Function to initialize Sandbox for executing remote procedures
Parameters:
Name Type Description
map function The map function that has to be executed
reduce function The reduce function that has to be executed on the server
scope JSON The custom scope that each function needs to be run on
Source:

initializeUtilities(streamlogger)

Function to set the stream logger as a utility
Parameters:
Name Type Description
streamlogger Object The stream logger object.
Source:

setArray(array)

Setter for the array variable
Parameters:
Name Type Description
array Array The array to be set
Source: