Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Cluster

Cluster utility for working with the thread from the master process

Hierarchy

  • ThreadComms
    • Cluster

Index

Constructors

constructor

  • new Cluster(id: string, master: Master, fileName?: string, custom?: boolean): Cluster
  • Parameters

    • id: string
    • master: Master
    • fileName: string = ...
    • custom: boolean = false

    Returns Cluster

Properties

custom

custom: boolean = false

dying

dying: boolean = false

Whether or not the Cluster shouldn't restart

fileName

fileName: string = ...

id

id: string

master

master: Master

spawned

spawned: boolean = false

Whether or not the cluster has been spawned before

started

started: boolean = false

Whether or not the Cluster is currently online

Methods

_emit

  • _emit<K>(event: K, data: ThreadCommsEventEmitter[K], resolve: ResolveFunction<K>): boolean
  • Type parameters

    Parameters

    • event: K
    • data: ThreadCommsEventEmitter[K]
    • resolve: ResolveFunction<K>

    Returns boolean

eval

  • eval(code: string): Promise<any[]>
  • Evals code on the cluster

    Parameters

    • code: string

      Code to eval

    Returns Promise<any[]>

getGuild

  • getGuild(id: string): Promise<APIGuild>
  • Gets a guild from the clusters cache

    Parameters

    • id: string

      ID of guild

    Returns Promise<APIGuild>

kill

  • kill(): void
  • Kills cluster without restarting

    Returns void

logAs

  • logAs(msg: string): void
  • Parameters

    • msg: string

    Returns void

register

  • register(comms: Worker | MessagePort): void
  • Parameters

    • comms: Worker | MessagePort

    Returns void

restart

  • restart(): void
  • Restarts the cluster

    Returns void

restartShard

  • restartShard(id: number): void
  • Restarts a shard

    Parameters

    • id: number

      ID of shard to restart

    Returns void

sendCommand

spawn

  • spawn(): Promise<void>
  • Returns Promise<void>

start

  • start(): Promise<undefined | {}>
  • Returns Promise<undefined | {}>

tell

Generated using TypeDoc