Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
fdec6bd
doc: allow <code> in header elements
Trott Dec 23, 2019
5998523
doc,dns: use code markup/markdown in headers
Trott Dec 23, 2019
d0f9585
doc: use code markup/markdown in headers in addons documentation
Trott Dec 23, 2019
b5834a4
doc,assert: use code markup/markdown in headers
Trott Dec 23, 2019
a5eb139
doc,async_hooks: use code markup/markdown in headers
Trott Dec 23, 2019
5847a4d
doc,buffer: use code markup/markdown in headers
Trott Dec 23, 2019
19419a4
doc,child_process: use code markup/markdown in headers
Trott Dec 23, 2019
4459988
doc,cluster: use code markup/markdown in headers
Trott Dec 24, 2019
adc9fa2
doc,console: use code markup/markdown in headers
Trott Dec 24, 2019
f6b6701
doc,crypto: use code markup/markdown in headers
Trott Dec 24, 2019
8e7d61e
doc: use code markup/markdown in headers in deprecations documentation
Trott Dec 24, 2019
0c8ff7c
doc,dgram: use code markup/markdown in headers
Trott Dec 24, 2019
75ab328
doc,domain: use code markup/markdown in headers
Trott Dec 24, 2019
57f7537
doc,errors: use code markup/markdown in headers
Trott Dec 24, 2019
b3ff048
doc,esm: use code markup/markdown in headers
Trott Dec 24, 2019
36edbde
doc,events: use code markup/markdown in headers
Trott Dec 24, 2019
b407503
doc,fs: use code markup/markdown in headers
Trott Dec 24, 2019
6f5e765
doc: use code markup/markdown in headers in globals documentation
Trott Dec 24, 2019
f8795db
doc,http: use code markup/markdown in headers
Trott Dec 24, 2019
2d6949d
doc,http2: use code markup/markdown in headers
Trott Dec 24, 2019
fe4a7a2
doc,https: use code markup/markdown in headers
Trott Dec 24, 2019
fc94934
doc,inspector: use code markup/markdown in headers
Trott Dec 24, 2019
248f057
doc,module: use code markup/markdown in headers
Trott Dec 24, 2019
933fd9b
doc,net: use code markup/markdown in headers
Trott Dec 24, 2019
24f24d9
doc,os: use code markup/markdown in headers
Trott Dec 24, 2019
a70c3ab
doc,path: use code markup/markdown in headers
Trott Dec 24, 2019
c956cab
doc,perf_hooks: use code markup/markdown in headers
Trott Dec 24, 2019
fc0aa3f
doc,process: use code markup/markdown in headers
Trott Dec 24, 2019
1c33523
doc,punycode: use code markup/markdown in headers
Trott Dec 24, 2019
d592efe
doc,querystring: use code markup/markdown in headers
Trott Dec 24, 2019
8b89c89
doc,readline: use code markup/markdown in headers
Trott Dec 24, 2019
85aed3e
doc,repl: use code markup/markdown in headers
Trott Dec 24, 2019
7034a3e
doc,stream: use code markup/markdown in headers
Trott Dec 24, 2019
cdb727d
doc,string_decoder: use code markup/markdown in headers
Trott Dec 24, 2019
7bb1f47
doc,timers: use code markup/markdown in headers
Trott Dec 24, 2019
e11b327
doc,tls: use code markup/markdown in headers
Trott Dec 24, 2019
a80d4ac
doc,tty: use code markup/markdown in headers
Trott Dec 24, 2019
79f6412
doc,url: use code markup/markdown in headers
Trott Dec 24, 2019
d9004da
doc,zlib: use code markup/markdown in headers
Trott Dec 24, 2019
ff6e7a0
doc,util: use code markup/markdown in headers
Trott Dec 24, 2019
ae4cd76
doc,v8: use code markup/markdown in headers
Trott Dec 24, 2019
deb0c81
doc,worker: use code markup/markdown in headers
Trott Dec 24, 2019
257a5dd
doc,vm: use code markup/markdown in headers
Trott Dec 25, 2019
b46efa9
doc,wasi: use code markup/markdown in headers
Trott Dec 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc,cluster: use code markup/markdown in headers
PR-URL: #31086
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
Trott committed Dec 27, 2019
commit 4459988d0e1e24549b63856387dd7c1b61e1d87a
62 changes: 31 additions & 31 deletions doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ responsibility to manage the worker pool based on its own needs.
Although a primary use case for the `cluster` module is networking, it can
also be used for other use cases requiring worker processes.

## Class: Worker
## Class: `Worker`
<!-- YAML
added: v0.7.0
-->
Expand All @@ -122,7 +122,7 @@ A `Worker` object contains all public information and method about a worker.
In the master it can be obtained using `cluster.workers`. In a worker
it can be obtained using `cluster.worker`.

### Event: 'disconnect'
### Event: `'disconnect'`
<!-- YAML
added: v0.7.7
-->
Expand All @@ -135,7 +135,7 @@ cluster.fork().on('disconnect', () => {
});
```

### Event: 'error'
### Event: `'error'`
<!-- YAML
added: v0.7.3
-->
Expand All @@ -144,7 +144,7 @@ This event is the same as the one provided by [`child_process.fork()`][].

Within a worker, `process.on('error')` may also be used.

### Event: 'exit'
### Event: `'exit'`
<!-- YAML
added: v0.11.2
-->
Expand All @@ -168,7 +168,7 @@ worker.on('exit', (code, signal) => {
});
```

### Event: 'listening'
### Event: `'listening'`
<!-- YAML
added: v0.7.0
-->
Expand All @@ -185,7 +185,7 @@ cluster.fork().on('listening', (address) => {

It is not emitted in the worker.

### Event: 'message'
### Event: `'message'`
<!-- YAML
added: v0.7.0
-->
Expand Down Expand Up @@ -244,7 +244,7 @@ if (cluster.isMaster) {
}
```

### Event: 'online'
### Event: `'online'`
<!-- YAML
added: v0.7.0
-->
Expand All @@ -259,7 +259,7 @@ cluster.fork().on('online', () => {

It is not emitted in the worker.

### worker.disconnect()
### `worker.disconnect()`
<!-- YAML
added: v0.7.7
changes:
Expand Down Expand Up @@ -329,7 +329,7 @@ if (cluster.isMaster) {
}
```

### worker.exitedAfterDisconnect
### `worker.exitedAfterDisconnect`
<!-- YAML
added: v6.0.0
-->
Expand All @@ -355,7 +355,7 @@ cluster.on('exit', (worker, code, signal) => {
worker.kill();
```

### worker.id
### `worker.id`
<!-- YAML
added: v0.8.0
-->
Expand All @@ -368,7 +368,7 @@ Each new worker is given its own unique id, this id is stored in the
While a worker is alive, this is the key that indexes it in
`cluster.workers`.

### worker.isConnected()
### `worker.isConnected()`
<!-- YAML
added: v0.11.14
-->
Expand All @@ -377,7 +377,7 @@ This function returns `true` if the worker is connected to its master via its
IPC channel, `false` otherwise. A worker is connected to its master after it
has been created. It is disconnected after the `'disconnect'` event is emitted.

### worker.isDead()
### `worker.isDead()`
<!-- YAML
added: v0.11.14
-->
Expand Down Expand Up @@ -415,7 +415,7 @@ if (cluster.isMaster) {
}
```

### worker.kill(\[signal='SIGTERM'\])
### `worker.kill([signal='SIGTERM'])`
<!-- YAML
added: v0.9.12
-->
Expand All @@ -439,7 +439,7 @@ This method is aliased as `worker.destroy()` for backwards compatibility.
In a worker, `process.kill()` exists, but it is not this function;
it is [`kill()`][].

### worker.process
### `worker.process`
<!-- YAML
added: v0.7.0
-->
Expand All @@ -456,7 +456,7 @@ Workers will call `process.exit(0)` if the `'disconnect'` event occurs
on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
accidental disconnection.

### worker.send(message\[, sendHandle\[, options\]\]\[, callback\])
### `worker.send(message[, sendHandle[, options]][, callback])`
<!-- YAML
added: v0.7.0
changes:
Expand Down Expand Up @@ -498,7 +498,7 @@ if (cluster.isMaster) {
}
```

## Event: 'disconnect'
## Event: `'disconnect'`
<!-- YAML
added: v0.7.9
-->
Expand All @@ -519,7 +519,7 @@ cluster.on('disconnect', (worker) => {
});
```

## Event: 'exit'
## Event: `'exit'`
<!-- YAML
added: v0.7.9
-->
Expand All @@ -543,7 +543,7 @@ cluster.on('exit', (worker, code, signal) => {

See [`child_process` event: `'exit'`][].

## Event: 'fork'
## Event: `'fork'`
<!-- YAML
added: v0.7.0
-->
Expand Down Expand Up @@ -571,7 +571,7 @@ cluster.on('exit', (worker, code, signal) => {
});
```

## Event: 'listening'
## Event: `'listening'`
<!-- YAML
added: v0.7.0
-->
Expand Down Expand Up @@ -602,7 +602,7 @@ The `addressType` is one of:
* `-1` (Unix domain socket)
* `'udp4'` or `'udp6'` (UDP v4 or v6)

## Event: 'message'
## Event: `'message'`
<!-- YAML
added: v2.5.0
changes:
Expand All @@ -619,7 +619,7 @@ Emitted when the cluster master receives a message from any worker.

See [`child_process` event: `'message'`][].

## Event: 'online'
## Event: `'online'`
<!-- YAML
added: v0.7.0
-->
Expand All @@ -637,7 +637,7 @@ cluster.on('online', (worker) => {
});
```

## Event: 'setup'
## Event: `'setup'`
<!-- YAML
added: v0.7.1
-->
Expand All @@ -652,7 +652,7 @@ The `settings` object is the `cluster.settings` object at the time

If accuracy is important, use `cluster.settings`.

## cluster.disconnect(\[callback\])
## `cluster.disconnect([callback])`
<!-- YAML
added: v0.7.7
-->
Expand All @@ -670,7 +670,7 @@ finished.

This can only be called from the master process.

## cluster.fork(\[env\])
## `cluster.fork([env])`
<!-- YAML
added: v0.6.0
-->
Expand All @@ -682,7 +682,7 @@ Spawn a new worker process.

This can only be called from the master process.

## cluster.isMaster
## `cluster.isMaster`
<!-- YAML
added: v0.8.1
-->
Expand All @@ -693,7 +693,7 @@ True if the process is a master. This is determined
by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID` is
undefined, then `isMaster` is `true`.

## cluster.isWorker
## `cluster.isWorker`
<!-- YAML
added: v0.6.0
-->
Expand All @@ -702,7 +702,7 @@ added: v0.6.0

True if the process is not a master (it is the negation of `cluster.isMaster`).

## cluster.schedulingPolicy
## `cluster.schedulingPolicy`
<!-- YAML
added: v0.11.2
-->
Expand All @@ -720,7 +720,7 @@ distribute IOCP handles without incurring a large performance hit.
`NODE_CLUSTER_SCHED_POLICY` environment variable. Valid
values are `'rr'` and `'none'`.

## cluster.settings
## `cluster.settings`
<!-- YAML
added: v0.7.1
changes:
Expand Down Expand Up @@ -772,7 +772,7 @@ contain the settings, including the default values.

This object is not intended to be changed or set manually.

## cluster.setupMaster(\[settings\])
## `cluster.setupMaster([settings])`
<!-- YAML
added: v0.7.1
changes:
Expand Down Expand Up @@ -812,7 +812,7 @@ cluster.fork(); // http worker

This can only be called from the master process.

## cluster.worker
## `cluster.worker`
<!-- YAML
added: v0.7.0
-->
Expand All @@ -833,7 +833,7 @@ if (cluster.isMaster) {
}
```

## cluster.workers
## `cluster.workers`
<!-- YAML
added: v0.7.0
-->
Expand Down