status-sharding
Version:
Welcome to Status Sharding! This package is designed to provide an efficient and flexible solution for sharding Discord bots, allowing you to scale your bot across multiple processes or workers.
41 lines (40 loc) • 1.49 kB
TypeScript
import { ChildProcess, ForkOptions } from 'child_process';
import { SerializableInput, Serializable } from '../types';
/** Options for the child process. */
export interface ChildProcessOptions extends ForkOptions {
/** Data to send to the cluster. */
clusterData?: NodeJS.ProcessEnv | undefined;
/** The arguments to pass to the child process. */
args?: string[] | undefined;
}
/** Child class. */
export declare class Child {
private file;
/** The child process. */
process: ChildProcess | null;
/** The options for the child process. */
processOptions: ForkOptions & {
args?: string[];
};
/** Creates an instance of Child. */
constructor(file: string, options: ChildProcessOptions);
/** Spawns the child process. */
spawn(): ChildProcess;
/** Respawns the child process. */
respawn(): Promise<ChildProcess>;
/** Kills the child process. */
kill(): Promise<boolean>;
/** Sends a message to the child process. */
send<T extends Serializable>(message: SerializableInput<T, true>): Promise<void>;
}
/** Child client class. */
export declare class ChildClient {
/** The IPC process. */
readonly ipc: NodeJS.Process;
/** Creates an instance of ChildClient. */
constructor();
/** Sends a message to the child process. */
send<T extends Serializable>(message: SerializableInput<T, true>): Promise<void>;
/** Gets the data of the child process. */
getData(): NodeJS.ProcessEnv;
}