Class: worker

clusterproxy. worker

new worker(options)

The interface for the worker processes.
Parameters:
Name Type Argument Description
options Object <optional>
The options hash.
Properties
Name Type Argument Default Description
logger Logger <optional>
A logger object (conforms to log4js logger interface) to be used on the master.
msgType String <optional>
The value of the `type` field of the messages, it has to match the master's; so multiple types can be used to support various delegate objects.
timeout Object <optional>
1000 The timeout
Source:

Methods

del(property, callback) → {undefined}

Deletes a property of the delegate on master.
Parameters:
Name Type Argument Description
property String The name of the property to delete.
callback clusterproxy.worker~delCallback <optional>
The function that will be called after the property is deleted, with the old value.
Source:
Returns:
Type
undefined

get(property, callback) → {undefined}

Gets a property of the delegate on master.
Parameters:
Name Type Description
property String The name of the property to get.
callback clusterproxy.worker~getCallback The function that will be called with the value of the property.
Source:
Returns:
Type
undefined

invoke(method, args, callback) → {undefined}

Calls a method of the delegate on master.
Parameters:
Name Type Argument Description
method String the name of the method to invoke on the delegate.
args * <optional>
<repeatable>
Arguments for the invoked method.
callback clusterproxy.worker~invokeCallback <optional>
The function that will be called with the error code and the result of the method call.
Source:
Returns:
Type
undefined

invokeAsync(method, args, callback) → {undefined}

Calls a method of the delegate on master, with 'continuation passing style', assuming the last argument is the callback.
Parameters:
Name Type Argument Description
method String the name of the method to invoke on the delegate.
args * <optional>
<repeatable>
Arguments for the invoked method, in the same order as in the invoked method.
callback clusterproxy.worker~invokeAsyncCallback The function that will be called with the error code and rest of the arguments that the invoked callback received.
Source:
Returns:
Type
undefined

invokeAsyncWithCallbackIndex(method, callbackIndex, args, callback) → {undefined}

Calls a method of the delegate on master, with 'continuation passing style'.
Parameters:
Name Type Argument Description
method String the name of the method to invoke on the delegate.
callbackIndex Number The index of the callback method on the invoked method arguments.
args * <optional>
<repeatable>
Arguments for the invoked method, in the same order as in the invoked method (that is, the callback is in `callbackIndex+2` position; taking into account the two first arguments).
callback clusterproxy.worker~invokeAsyncCallback The function that will be called with the error code and rest of the arguments that the invokee callback received.
Source:
Returns:
Type
undefined

set(property, value, callback) → {undefined}

Sets a property of the delegate on mater.
Parameters:
Name Type Argument Description
property String The name of the property to set.
value * The value of the property to set.
callback clusterproxy.worker~setCallback <optional>
The function that will be called after the property is set, with the old value.
Source:
Returns:
Type
undefined

Type Definitions

delCallback(proxyError, oldValue)

Parameters:
Name Type Description
proxyError * Any error coming from clusterproxy itself, or exceptions thrown deleting the property.
oldValue * The old value of the deleted property.
Source:

getCallback(proxyError, value)

Parameters:
Name Type Description
proxyError * Any error coming from clusterproxy itself, or exceptions thrown getting the property.
value * The value of the property.
Source:

invokeAsyncCallback(proxyError, results)

Parameters:
Name Type Argument Description
proxyError * Any error coming from clusterproxy itself, or exceptions thrown by the invoked method.
results * <optional>
<repeatable>
Any arguments that the invokee callback received. For node/async style that means that the two first arguments might be error codes, but cluster proxy is agnostic to that.
Source:

invokeCallback(proxyError, result)

Parameters:
Name Type Argument Description
proxyError * Any error coming from clusterproxy itself, or exceptions thrown by the invoked method.
result * <optional>
The return value of the invoked method.
Source:

setCallback(proxyError, oldValue)

Parameters:
Name Type Description
proxyError * Any error coming from clusterproxy itself, or exceptions thrown setting the property.
oldValue * The old value of the set property.
Source: