@cuties/cluster
Cutie extension for cluster module in Node.
Last updated a year ago by guseyn .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @cuties/cluster 
SYNC missed versions from official npm registry.

cutie-cluster

NPM Version Build Status codecov

Cutie extension for cluster module in Node. It's based on the Async Tree Pattern.

Examples

You can find examples of using this library in the test directory.

Install

npm install @cuties/cluster

Run test

npm test

Run build

npm run build

Usage

const {
  // Needed async objects here from the table below
} = require('@cuties/cluster');

For more information about parameters in the async objects visit docs of Node for cluster module.

cluster

Async Object Async/sync call Parameters(default value/description) Representation result
ClusterWithDisconnectEvent cluster.on('disconnect', event) cluster, event (Event with definedBody(worker)) cluster
ClusterWithExitEvent cluster.on('exit', event) cluster, event (Event with definedBody(worker, code, signal)) cluster
ClusterWithForkedWorkers for (let i = 0; i < num; i++) {cluster.fork(env);} cluster, num(number of workers), env cluster
ClusterWithForkEvent cluster.on('fork', event) cluster, event (Event with definedBody(worker)) cluster
ClusterWithListeningEvent cluster.on('listening', event) cluster, event (Event with definedBody(worker, address)) cluster
ClusterWithMessageEvent cluster.on('message', event) cluster, event (Event with definedBody(worker, message, handle)) cluster
ClusterWithOnlineEvent cluster.on('online', event) cluster, event (Event with definedBody(worker)) cluster
HasWorkers Object.keys(cluster.workers) > 0 cluster boolean

worker

Async Object Async/sync call Parameters(default value/description) Representation result
DisconnectedWorker worker.disconnect worker worker
ForkedWorker cluster.fork cluster, env worker
IsConnected worker.isConnected worker boolean
IsDead worker.isDead worker boolean
IsExitedAfterDisconnect worker.exitedAfterDisconnect worker boolean
KilledWorker worker.kill worker, signal('SIGTERM') worker
SentMessage worker.send worker, message[, sendHandle][, callback] message(string)
Worker cluster.worker cluster worker
WorkerId worker.id worker number
WorkerProcess worker.process worker process
Workers cluster.workers cluster object
WorkerWithDisconnectEvent worker.on('disconnect', event) worker, event(Event with definedBody()) worker
WorkerWithErrorEvent worker.on('error', event) worker, event(Event with definedBody(error)) worker
WorkerWithExitEvent worker.on('exit', event) worker, event(Event with definedBody(code, signal)) worker
WorkerWithListeningEvent worker.on('listening', event) worker, event(Event with definedBody(address)) worker
WorkerWithMessageEvent worker.on('message', event) worker, event(Event with definedBody(msg)) worker
WorkerWithOnlineEvent worker.on('online', event) worker, event (Event with definedBody()) worker

common

Async Object Async/sync call Parameters(default value/description) Representation result
IsMaster cluster.isMaster cluster boolean
IsWorker cluster.isWorker cluster boolean
SchedulingPolicy cluster.schedulingPolicy cluster number
Settings cluster.settings cluster object
SetupMaster cluster cluster, settings process

Current Tags

  • 1.1.2                                ...           latest (a year ago)

8 Versions

  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (6)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |