///
import { ClusterController } from '++/libs/cluster/cluster-controller'
import * as cluster from 'node:cluster'
declare global {
namespace Cluster {
interface Worker extends cluster.Worker {}
interface WorkerConfig {
name: string,
env: PlataEnv,
onStart: () => Promise
controller?: (controller: ClusterController) => Promise
workers?: number,
workersEnv?: any,
onExit?: (worker: cluster.Worker, code: number, signal: string) => void,
}
interface ClusterConfig {
controllerPid?: number
pids: number[]
config: WorkerConfig
}
interface PlataClusterActions {
KILL: string
ECHO: Cluster.UserActions
'ECHO-CLUSTER': {
name: string
data: Cluster.UserActions
}
'ECHO-PID': {
pid: number
data: Cluster.UserActions
}
'GET-PIDS-CLUSTER': {
name: LooseAutocomplete<'__PLATA_EXPRESS__'>
id: string
}
'DEAD-WORKER-NOTIFY': {
clusterName: string
pidDead: number
newPid: number
}
RELOAD: true
[K: `GET-PIDS-CLUSTER-RESULT-${string}`]: PlataResult
}
}
interface UserClusterActions {}
}