Comparing version 0.5.3 to 0.5.4
var Terror = require('terror'), | ||
errors = {}, | ||
LusterError; | ||
errors = {}; | ||
@@ -10,9 +9,7 @@ /** | ||
*/ | ||
LusterError = Terror.create( | ||
'LusterError', | ||
var LusterError = errors.LusterError = Terror.create('LusterError', | ||
{ | ||
ABSTRACT_METHOD_IS_NOT_IMPLEMENTED : | ||
[ 9000, 'Abstract method "%method%" is not implemented in the %klass%' ] | ||
'Abstract method "%method%" is not implemented in the %klass%' | ||
}); | ||
errors.LusterError = LusterError; | ||
@@ -24,15 +21,14 @@ /** | ||
*/ | ||
errors.LusterConfigurationError = LusterError.create( | ||
'LusterConfigurationError', | ||
errors.LusterConfigurationError = LusterError.create('LusterConfigurationError', | ||
{ | ||
CONFIGURATION_CHECK_FAILED : | ||
[ 9100, 'Configuration check failed' ], | ||
'Configuration check failed', | ||
PROP_REQUIRED : | ||
[ 9101, 'Required property "%property%" is absent' ], | ||
'Required property "%property%" is absent', | ||
PROP_TYPE_CHECK_FAILED : | ||
[ 9102, 'Property "%property%" type is "%type%", but %expected% is expected' ], | ||
'Property "%property%" type is "%type%", but %expected% is expected', | ||
PROP_REGEXP_CHECK_FAILED : | ||
[ 9103, 'Property "%property%" doesn\'t meet the regexp "%regexp%"' ], | ||
'Property "%property%" doesn\'t meet the regexp "%regexp%"', | ||
CAN_NOT_SET_ATOMIC_PROPERTY_FIELD : | ||
[ 9104, 'Property "%path%" is exist and is not an object' ] | ||
'Property "%path%" is exist and is not an object' | ||
}); | ||
@@ -45,9 +41,8 @@ | ||
*/ | ||
errors.LusterWorkerWrapperError = LusterError.create( | ||
'LusterWorkerWrapperError', | ||
errors.LusterWorkerWrapperError = LusterError.create('LusterWorkerWrapperError', | ||
{ | ||
INVALID_ATTEMPT_TO_CHANGE_STATE : | ||
[ 9200, 'Invalid attempt to change worker #%wid% (pid: %pid%) state from "%state%" to "%targetState%"' ], | ||
'Invalid attempt to change worker #%wid% (pid: %pid%) state from "%state%" to "%targetState%"', | ||
REMOTE_COMMAND_CALL_TO_STOPPED_WORKER : | ||
[ 9201, 'Remote command call "%command%" to stopped worker #%wid%' ] | ||
'Remote command call "%command%" to stopped worker #%wid%' | ||
}); | ||
@@ -60,11 +55,10 @@ | ||
*/ | ||
errors.LusterClusterProcessError = LusterError.create( | ||
'LusterClusterProcessError', | ||
errors.LusterClusterProcessError = LusterError.create('LusterClusterProcessError', | ||
{ | ||
REMOTE_COMMAND_ALREADY_REGISTERED : | ||
[ 9300, 'Command "%name%" already registered as allowed for remote calls' ], | ||
'Command "%name%" already registered as allowed for remote calls', | ||
REMOTE_COMMAND_IS_NOT_REGISTERED : | ||
[ 9301, 'Remote command "%name%" is not registered on %klass%' ], | ||
'Remote command "%name%" is not registered on %klass%', | ||
EXTENSIONS_LOAD_TIMEOUT : | ||
[ 9302, 'Extensions %timeouted% not loaded in %timeout% ms' ] | ||
'Extensions %timeouted% not loaded in %timeout% ms' | ||
}); | ||
@@ -77,11 +71,11 @@ | ||
*/ | ||
errors.LusterPortError = LusterError.create( | ||
'LusterPortError', | ||
errors.LusterPortError = LusterError.create('LusterPortError', | ||
{ | ||
NOT_UNIX_SOCKET : | ||
[ 9400, '"%value%" is not a unix socket' ], | ||
'"%value%" is not a unix socket', | ||
CAN_NOT_UNLINK_UNIX_SOCKET : | ||
[ 9401, 'Can not unlink unix socket "%socketPath%"' ] | ||
'Can not unlink unix socket "%socketPath%"' | ||
}); | ||
module.exports = errors; | ||
@@ -49,2 +49,3 @@ var os = require('os'), | ||
this.wid = 0; | ||
this.pid = process.pid; | ||
@@ -51,0 +52,0 @@ this.on('worker ready', this._onWorkerReady.bind(this)); |
@@ -131,2 +131,15 @@ var cluster = require('cluster'), | ||
/** | ||
* @property {Number} pid System process identifier | ||
* @memberOf {WorkerWrapper} | ||
* @public | ||
* @readonly | ||
*/ | ||
Object.defineProperty(this, 'pid', { | ||
get : function() { | ||
return this.process.pid; | ||
}, | ||
enumerable : true | ||
}); | ||
/** | ||
* Current WorkerWrapper instance state | ||
@@ -309,4 +322,5 @@ * @see WorkerWrapper.STATES for possible values. | ||
this.remoteCall(RPC.fns.worker.applyForeignProperties, { | ||
wid : this.wid | ||
}); | ||
wid : this.wid, | ||
pid : this.process.pid | ||
}); | ||
}; | ||
@@ -559,2 +573,3 @@ | ||
wid : this.wid, | ||
pid : this.process.pid, | ||
command : name | ||
@@ -561,0 +576,0 @@ })); |
{ | ||
"name" : "luster", | ||
"version" : "0.5.3", | ||
"version" : "0.5.4", | ||
"description" : "Node.js cluster wrapper", | ||
@@ -37,3 +37,3 @@ "main" : "./lib/luster.js", | ||
"objex" : "0.3.x", | ||
"terror" : "0.4.x", | ||
"terror" : "^1.0.0", | ||
"extend": "2.0.0" | ||
@@ -40,0 +40,0 @@ }, |
@@ -1,3 +0,7 @@ | ||
# luster | ||
Luster [![NPM version][npm-image]][npm-link] | ||
====== | ||
[![Dependency status][deps-image]][deps-link] | ||
[![Development Dependency status][devdeps-image]][devdeps-link] | ||
## Core features | ||
@@ -38,3 +42,21 @@ | ||
### How luster tries to resolve a path to configuration file | ||
Following example written in plain JavaScript, not JSON, so you can name it | ||
`luster.conf.js` to launch luster without options, | ||
or pass the configuration file path as the first argument to the script: | ||
```console | ||
$ ./node_modules/.bin/luster ./configs/my_luster_configuration.js | ||
``` | ||
Internally, luster tries to call the `require()` in the following way: | ||
```javascript | ||
require(path.resolve(process.cwd(), process.argv[2] || './luster.conf')); | ||
``` | ||
### Annotated example of configuration | ||
```javascript | ||
module.exports = { | ||
@@ -76,2 +98,6 @@ // required, absolute or relative path to configuration file | ||
// with group number | ||
// | ||
// worker can get port number to listen from the environment variable | ||
// `port`, for example: | ||
// > server.listen(process.env.port) | ||
port : 8080, | ||
@@ -188,1 +214,8 @@ | ||
Callback accepts one optional argument: an error, if initalization failed. | ||
[npm-image]: https://img.shields.io/npm/v/luster.svg?style=flat | ||
[npm-link]: https://npmjs.org/package/luster | ||
[deps-image]: https://img.shields.io/david/nodules/luster.svg?style=flat | ||
[deps-link]: https://david-dm.org/nodules/luster | ||
[devdeps-image]: https://img.shields.io/david/dev/nodules/luster.svg?style=flat | ||
[devdeps-link]: https://david-dm.org/nodules/luster#info=devDependencies |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1990
219
79641
19
+ Addedterror@1.4.0(transitive)
- Removedobjex@0.2.5(transitive)
- Removedterror@0.4.0(transitive)
Updatedterror@^1.0.0