diff --git a/src/sharding/Shard.js b/src/sharding/Shard.js index cbe85110b..b54701f40 100644 --- a/src/sharding/Shard.js +++ b/src/sharding/Shard.js @@ -6,7 +6,8 @@ const { Error } = require('../errors'); const delayFor = require('util').promisify(setTimeout); /** - * Represents a Shard spawned by the ShardingManager. + * A self-contained shard spawned by the {@link ShardingManager}. + * @extends EventEmitter */ class Shard extends EventEmitter { /** @@ -171,7 +172,7 @@ class Shard extends EventEmitter { } /** - * Evaluates a script on the shard, in the context of the client. + * Evaluates a script on the shard, in the context of the {@link Client}. * @param {string} script JavaScript to run on the shard * @returns {Promise<*>} Result of the script execution */ diff --git a/src/sharding/ShardClientUtil.js b/src/sharding/ShardClientUtil.js index b62cb36c4..b0e9d57ed 100644 --- a/src/sharding/ShardClientUtil.js +++ b/src/sharding/ShardClientUtil.js @@ -3,7 +3,8 @@ const { Events } = require('../util/Constants'); const { Error } = require('../errors'); /** - * Helper class for sharded clients spawned as a child process, such as from a ShardingManager. + * Helper class for sharded clients spawned as a child process, such as from a {@link ShardingManager}. + * Utilises IPC to send and receive data to/from the master process and other shards. */ class ShardClientUtil { /** @@ -78,7 +79,7 @@ class ShardClientUtil { } /** - * Evaluates a script on all shards, in the context of the Clients. + * Evaluates a script on all shards, in the context of the {@link Clients}. * @param {string} script JavaScript to run on each shard * @returns {Promise>} Results of the script execution * @see {@link ShardingManager#broadcastEval} diff --git a/src/sharding/ShardingManager.js b/src/sharding/ShardingManager.js index bbe5e7724..4b0ad7b87 100644 --- a/src/sharding/ShardingManager.js +++ b/src/sharding/ShardingManager.js @@ -8,9 +8,12 @@ const { Error, TypeError, RangeError } = require('../errors'); const delayFor = require('util').promisify(setTimeout); /** - * This is a utility class that can be used to help you spawn shards of your client. Each shard is completely separate - * from the other. The Shard Manager takes a path to a file and spawns it under the specified amount of shards safely. - * If you do not select an amount of shards, the manager will automatically decide the best amount. + * This is a utility class that makes multi-process sharding of a bot an easy and painless experience. + * It works by spawning a self-contained {@link ChildProcess} for each individual shard, each containing its own client. + * They all have a line of communication with the master process, and there are several useful methods that utilise + * it in order to simplify tasks that are normally difficult with multi-process sharding. It can spawn a specific number + * of shards or the amount that Discord suggests for the bot, and takes a path to your main bot script to launch for + * each one. * @extends {EventEmitter} */ class ShardingManager extends EventEmitter { @@ -148,7 +151,7 @@ class ShardingManager extends EventEmitter { } /** - * Evaluates a script on all shards, in the context of the Clients. + * Evaluates a script on all shards, in the context of the {@link Client}s. * @param {string} script JavaScript to run on each shard * @returns {Promise>} Results of the script execution */