Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Thread

Thread interface for interacting with the master process from a worker

Hierarchy

  • ThreadComms
    • Thread

Index

Constructors

constructor

  • Parameters

    • worker: Worker<{}> = ...
    • register: boolean = true

    Returns Thread

Properties

id

id: string

worker

worker: Worker<{}> = ...

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

broadcastEval

  • broadcastEval(code: string): Promise<any[]>
  • Eval code on every cluster

    Parameters

    • code: string

      Code to eval

    Returns Promise<any[]>

    Response

destroy

  • destroy(): void
  • Destroys entire master.

    Returns void

getGuild

  • getGuild(guildId: string): Promise<APIGuild>
  • Gets a cached guild across clusters

    Parameters

    • guildId: string

      ID of guild

    Returns Promise<APIGuild>

    The guild

getStats

  • Gets an array of each clusters stats

    Returns Promise<ClusterStats[]>

    Stats

log

  • log(...messages: any[]): void
  • Logs data to master's MasterOptions.log

    Parameters

    • Rest ...messages: any[]

    Returns void

masterEval

  • masterEval(code: string): Promise<any>
  • Evals code on the master process

    Parameters

    • code: string

      Code to eval

    Returns Promise<any>

    Response

register

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

    • comms: Worker | MessagePort

    Returns void

registerShard

  • registerShard(id: number): Promise<{}>
  • Parameters

    • id: number

    Returns Promise<{}>

restartCluster

  • restartCluster(clusterId: string): void
  • Restarts a specific cluster

    Parameters

    • clusterId: string

      ID of cluster

    Returns void

restartShard

  • restartShard(shardId: any): void
  • Restarts a specific shard

    Parameters

    • shardId: any

      ID of shard

    Returns void

sendCommand

tell

Generated using TypeDoc