Class: ShardInfo

ShardingMaster. ShardInfo


new ShardInfo(id)

Stores information about a single shard necessary for the ShardingMaster to operate.
Parameters:
Name Type Description
id string The ID of the shard this status object contains data for.
Source:

Members


bootTime :number

The most recent timestamp at which the shard was told to boot up.
Type:
  • number
Source:

createdTime :number

The timestamp at which the information for this shard was created, and sent to a sysadmin.
Type:
  • number
Source:

currentShardCount :number

The number of shards intended to be running according to this shard's current configuration. A value of 1 or less denotes this is the only shard. A default value of -1 is used to be similar to the ID values, but any value less than 2 is semantically the identical.
Type:
  • number
Source:

currentShardId :number

The Discord shard ID this shard currently is. A value less than 0 means the shard is currently shutdown.
Type:
  • number
Source:

goalShardCount :number

The number of shards intended to be running currently. A value of 1 or less denotes this is the only shard. A default value of -1 is used to be similar to the ID values, but any value less than 2 is semantically the identical.
Type:
  • number
Source:

goalShardId :number

The Discord shard ID this shard should be currently. A value less than 0 means the shard should be shutdown.
Type:
  • number
Source:

id :string

The ID of the shard this status object contains data for.
Type:
  • string
Source:

isMaster :boolean

Is this shard considered the master shard. There must be exactly one of these configured at all times, and in most cases can run in the same directory as the ShardingMaster. This shard will be told to not connect to Discord, and act as the master node for web requests.
Type:
  • boolean
Source:

<nullable> key :string

The public key identifying this shard, used for signing and verification.
Type:
  • string
Source:

lastHeartbeat :number

The last time at which a valid heartbeat was received from the shard indicating that it is still alive.
Type:
  • number
Source:

lastSeen :number

Timestamp of the last time the shard has been seen. This will be 0 if the shard has never attempted to communicate with the master.
Type:
  • number
Source:

serializable

Get the version of this object that can be converted to a string. Additionally, this will only contain the data intended to be saved to disk. `stats` will be excluded, and is intended to be saved separately.
Source:

<nullable> stats :ShardingMaster.ShardStatus

ShardStatus instance for this shard if it's been received.
Type:
Source:

stopTime :number

The most recent timestamp at which the shard was told to shut down.
Type:
  • number
Source:

Methods


<static> from(obj [, id])

Convert a given object to a ShardInfo object. Values are only copied if their types exactly match.
Parameters:
Name Type Argument Description
obj object The ShardInfo-like object to copy.
id string <optional>
If the given object does not specify the shard's ID, it may be passed here instead.
Source:
Returns:
Created ShardInfo object.
Type
ShardingMaster.ShardInfo

request()

Format this object into a request for a shard's state. This does not handle cold stops or full reboots, only modifying running state of the shard.
Source:
Returns:
Object with minimal data to inform the shard how it should currently be configured.
Type
object