Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rebranding as cluster

  • Loading branch information...
commit 2136fbfd5d07eca9a1d164259ec3b8f1f572dfab 1 parent ad99a1c
TJ Holowaychuk tj authored
20 docs/api.md
View
@@ -1,11 +1,11 @@
## API
- The Engine API at its core is extremely simple, all we need to do is pass
- our http `server` to `engine()`, then call `listen()` as we would on the `http.Server` itself.
+ The Cluster API at its core is extremely simple, all we need to do is pass
+ our http `server` to `cluster()`, then call `listen()` as we would on the `http.Server` itself.
- var engine = require('../')
+ var cluster = require('../')
, http = require('http');
var server = http.createServer(function(req, res){
@@ -13,7 +13,7 @@
res.end('Hello World');
});
- engine(server)
+ cluster(server)
.listen(3000);
### Plugins
@@ -28,14 +28,14 @@
To use them, all we need to do is pass it to the `use()` method:
- engine(server)
+ cluster(server)
.use(myPlugin('/some/path'))
.listen(3000);
- To use a plugin that is bundled with Engine simply grab it from the `engine` object:
+ To use a plugin that is bundled with Cluster simply grab it from the `cluster` object:
- engine(server)
- .use(engine.logger())
+ cluster(server)
+ .use(cluster.logger())
.listen(3000);
### Settings
@@ -49,14 +49,14 @@
We can take what we have now, and go on to apply settings using the `set(option, value)` method. For example:
- engine(server)
+ cluster(server)
.set('working directory', '/')
.set('workers', 5)
.listen(3000);
### Signals
- Engine performs the following actions when handling signals:
+ Cluster performs the following actions when handling signals:
- `SIGINT` hard shutdown
- `SIGTERM` hard shutdown
4 docs/debug.md
View
@@ -22,6 +22,6 @@ Outputs verbose debugging information to _stderr_.
## Usage
- engine(server)
- .use(engine.debug())
+ cluster(server)
+ .use(cluster.debug())
.listen(3000);
12 docs/logger.md
View
@@ -16,20 +16,20 @@ The `logger([path[, level]])` plugin accepts an optional `path`, and optional `l
Outputting to `./logs`:
- engine(server)
- .use(engine.logger())
+ cluster(server)
+ .use(cluster.logger())
.listen(3000);
Outputting to `./tmp/logs`:
- engine(server)
- .use(engine.logger('tmp/logs'))
+ cluster(server)
+ .use(cluster.logger('tmp/logs'))
.listen(3000);
Outputting to `/var/log/node` with a log level of `debug`:
- engine(server)
- .use(engine.logger('/var/log/node', 'debug'))
+ cluster(server)
+ .use(cluster.logger('/var/log/node', 'debug'))
.listen(3000);
8 docs/pidfiles.md
View
@@ -15,12 +15,12 @@ The `pidfiles([path])` plugin saves pid (process-id) files to the given `path` o
save to `./pids`:
- engine(server)
- .use(engine.pidfiles())
+ cluster(server)
+ .use(cluster.pidfiles())
.listen(3000);
save to `/var/run/node`:
- engine(server)
- .use(engine.logger('/var/run/node'))
+ cluster(server)
+ .use(cluster.logger('/var/run/node'))
.listen(3000);
4 examples/basic.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, http = require('http');
var body = 'Hello World'
@@ -13,6 +13,6 @@ var server = http.createServer(function(req, res){
res.end(body);
});
-engine(server)
+cluster(server)
.set('working directory', '/')
.listen(3000);
8 examples/debug.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, http = require('http');
var server = http.createServer(function(req, res){
@@ -13,7 +13,7 @@ var server = http.createServer(function(req, res){
res.end(body);
});
-engine(server)
- .use(engine.logger('logs', 'debug'))
- .use(engine.debug())
+cluster(server)
+ .use(cluster.logger('logs', 'debug'))
+ .use(cluster.debug())
.listen(3000);
12 examples/error.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, http = require('http');
var server = http.createServer(function(req, res){
@@ -14,9 +14,9 @@ var server = http.createServer(function(req, res){
res.end(body);
});
-engine(server)
- .use(engine.debug())
- .use(engine.logger())
- .use(engine.stats())
- .use(engine.repl(__dirname + '/repl'))
+cluster(server)
+ .use(cluster.debug())
+ .use(cluster.logger())
+ .use(cluster.stats())
+ .use(cluster.repl(__dirname + '/repl'))
.listen(3000);
6 examples/logger.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, http = require('http');
var server = http.createServer(function(req, res){
@@ -13,6 +13,6 @@ var server = http.createServer(function(req, res){
res.end(body);
});
-engine(server)
- .use(engine.logger())
+cluster(server)
+ .use(cluster.logger())
.listen(3000);
6 examples/pids.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, http = require('http');
var body = 'Hello World'
@@ -13,6 +13,6 @@ var server = http.createServer(function(req, res){
res.end(body);
});
-engine(server)
- .use(engine.pidfiles())
+cluster(server)
+ .use(cluster.pidfiles())
.listen(3000);
8 examples/reload.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, http = require('http');
// try loading, and changing "Hello", to "Hello World"
@@ -15,8 +15,8 @@ var server = http.createServer(function(req, res){
res.end(body);
});
-engine(server)
+cluster(server)
.set('workers', 1)
- .use(engine.reload(__dirname))
- .use(engine.debug())
+ .use(cluster.reload(__dirname))
+ .use(cluster.debug())
.listen(3000);
10 examples/repl-unix.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, http = require('http');
var server = http.createServer(function(req, res){
@@ -15,14 +15,14 @@ var server = http.createServer(function(req, res){
// custom repl function
-engine.repl.define('echo', function(master, sock, msg){
+cluster.repl.define('echo', function(master, sock, msg){
sock.write(msg + '\n');
}, 'echo the given message');
// $ telnet /path/to/examples/repl
-engine(server)
+cluster(server)
.set('workers', 1)
- .use(engine.logger())
- .use(engine.repl(__dirname + '/repl'))
+ .use(cluster.logger())
+ .use(cluster.repl(__dirname + '/repl'))
.listen(3000);
14 examples/repl.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, http = require('http');
var server = http.createServer(function(req, res){
@@ -15,15 +15,15 @@ var server = http.createServer(function(req, res){
// custom repl function
-engine.repl.define('echo', function(master, sock, msg){
+cluster.repl.define('echo', function(master, sock, msg){
sock.write(msg + '\n');
}, 'echo the given message');
// $ telnet localhots 8888
-engine(server)
- .use(engine.logger('logs'))
- .use(engine.stats())
- .use(engine.repl(8888))
- .use(engine.debug())
+cluster(server)
+ .use(cluster.logger('logs'))
+ .use(cluster.stats())
+ .use(cluster.repl(8888))
+ .use(cluster.debug())
.listen(3000);
4 examples/single.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, http = require('http');
var body = 'Hello World'
@@ -13,7 +13,7 @@ var server = http.createServer(function(req, res){
res.end(body);
});
-engine(server)
+cluster(server)
.set('working directory', '/')
.set('workers', 1)
.listen(3000);
6 examples/stats.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, http = require('http');
var server = http.createServer(function(req, res){
@@ -13,6 +13,6 @@ var server = http.createServer(function(req, res){
res.end(body);
});
-engine(server)
- .use(engine.stats())
+cluster(server)
+ .use(cluster.stats())
.listen(3000);
4 examples/unix.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, http = require('http');
var body = 'Hello World'
@@ -13,6 +13,6 @@ var server = http.createServer(function(req, res){
res.end(body);
});
-engine(server)
+cluster(server)
.set('working directory', '/')
.listen('/tmp/server.sock');
2  index.js
View
@@ -1,2 +1,2 @@
-module.exports = require('./lib/engine');
+module.exports = require('./lib/cluster');
2  lib/engine.js → lib/cluster.js
View
@@ -1,6 +1,6 @@
/*!
- * Engine
+ * Cluster
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
3  lib/master.js
View
@@ -1,7 +1,6 @@
-
/*!
- * Engine - Master
+ * Cluster - Master
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
2  lib/mixins/receiver.js
View
@@ -1,6 +1,6 @@
/*!
- * Engine - receiver mixin
+ * Cluster - receiver mixin
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
2  lib/plugins/debug.js
View
@@ -1,6 +1,6 @@
/*!
- * Engine - debug
+ * Cluster - debug
* Copyright (c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
2  lib/plugins/logger.js
View
@@ -1,6 +1,6 @@
/*!
- * Engine - logger
+ * Cluster - logger
* Copyright (c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
2  lib/plugins/pidfiles.js
View
@@ -1,6 +1,6 @@
/*!
- * Engine - pidfiles
+ * Cluster - pidfiles
* Copyright (c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
2  lib/plugins/reload.js
View
@@ -1,6 +1,6 @@
/*!
- * Engine - reload
+ * Cluster - reload
* Copyright (c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
2  lib/plugins/repl.js
View
@@ -1,6 +1,6 @@
/*!
- * Engine - repl
+ * Cluster - repl
* Copyright (c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
2  lib/plugins/stats.js
View
@@ -1,6 +1,6 @@
/*!
- * Engine - stats
+ * Cluster - stats
* Copyright (c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
2  lib/utils.js
View
@@ -1,6 +1,6 @@
/*!
- * Engine - utils
+ * Cluster - utils
* Copyright (c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
2  lib/worker.js
View
@@ -1,6 +1,6 @@
/*!
- * Engine - Worker
+ * Cluster - Worker
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
8 test/test.basic.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, should = require('../support/should')
, http = require('http');
@@ -12,16 +12,16 @@ var server = http.createServer(function(req, res){
res.end('Hello World');
});
-engine = engine(server)
+cluster = cluster(server)
.listen(3000);
-engine.on('listening', function(){
+cluster.on('listening', function(){
http.get({ host: 'localhost', port: 3000 }, function(res){
res.on('data', function(chunk){
chunk.toString().should.equal('Hello World');
});
res.on('end', function(){
- engine.close();
+ cluster.close();
});
});
});
10 test/test.logger.custom-path.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, should = require('../support/should')
, http = require('http')
, fs = require('fs');
@@ -14,12 +14,12 @@ var server = http.createServer(function(req, res){
res.end('Hello World');
});
-engine = engine(server)
+cluster = cluster(server)
.set('workers', 1)
- .use(engine.logger(__dirname + '/logs/nested'))
+ .use(cluster.logger(__dirname + '/logs/nested'))
.listen(3000);
-engine.on('listening', function(){
+cluster.on('listening', function(){
http.get({ host: 'localhost', port: 3000 }, function(res){
res.on('end', function(){
var files = fs.readdirSync(__dirname + '/logs/nested');
@@ -27,7 +27,7 @@ engine.on('listening', function(){
files.should.contain('master.log');
files.should.contain('worker.0.access.log');
files.should.contain('worker.0.error.log');
- engine.close();
+ cluster.close();
});
});
});
10 test/test.logger.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, should = require('../support/should')
, http = require('http')
, fs = require('fs');
@@ -14,12 +14,12 @@ var server = http.createServer(function(req, res){
res.end('Hello World');
});
-engine = engine(server)
+cluster = cluster(server)
.set('workers', 1)
- .use(engine.logger())
+ .use(cluster.logger())
.listen(3000);
-engine.on('listening', function(){
+cluster.on('listening', function(){
http.get({ host: 'localhost', port: 3000 }, function(res){
res.on('end', function(){
var files = fs.readdirSync(__dirname + '/logs');
@@ -27,7 +27,7 @@ engine.on('listening', function(){
files.should.contain('master.log');
files.should.contain('worker.0.access.log');
files.should.contain('worker.0.error.log');
- engine.close();
+ cluster.close();
});
});
});
10 test/test.working-dir.js
View
@@ -3,7 +3,7 @@
* Module dependencies.
*/
-var engine = require('../')
+var cluster = require('../')
, should = require('../support/should')
, http = require('http');
@@ -12,15 +12,15 @@ var server = http.createServer(function(req, res){
res.end('Hello World');
});
-engine = engine(server)
+cluster = cluster(server)
.set('working directory', '/')
.listen(3000);
-if (engine.isWorker) {
+if (cluster.isWorker) {
process.cwd().should.equal('/');
}
-engine.on('listening', function(){
+cluster.on('listening', function(){
process.cwd().should.equal('/');
- engine.close();
+ cluster.close();
});
Please sign in to comment.
Something went wrong with that request. Please try again.