Projekt

Obecné

Profil

Stáhnout (1.55 KB) Statistiky
| Větev: | Revize:
1 3a515b92 cagy
import { ForkOptions } from "child_process";
2
3
export = Farm;
4
5
declare function Farm(name: string): Farm.Workers;
6
declare function Farm(name: string, exportedMethods: string[]): Farm.Workers;
7
declare function Farm(options: Farm.FarmOptions, name: string): Farm.Workers;
8
declare function Farm(
9
  options: Farm.FarmOptions,
10
  name: string,
11
  exportedMethods: string[],
12
): Farm.Workers;
13
14
type WorkerCallback0 = () => void;
15
type WorkerCallback1 = (arg1: any) => void;
16
type WorkerCallback2 = (arg1: any, arg2: any) => void;
17
type WorkerCallback3 = (arg1: any, arg2: any, arg3: any) => void;
18
type WorkerCallback4 = (arg1: any, arg2: any, arg3: any, arg4: any) => void;
19
20
declare namespace Farm {
21
  export function end(workers: Workers, callback?: Function): void;
22
23
  export interface Workers {
24
    [x: string]: Workers,
25
    (callback: WorkerCallback): void;
26
    (arg1: any, callback: WorkerCallback): void;
27
    (arg1: any, arg2: any, callback: WorkerCallback): void;
28
    (arg1: any, arg2: any, arg3: any, callback: WorkerCallback): void;
29
    (
30
      arg1: any,
31
      arg2: any,
32
      arg3: any,
33
      arg4: any,
34
      callback: WorkerCallback,
35
    ): void;
36
  }
37
38
  export interface FarmOptions {
39
    maxCallsPerWorker?: number;
40
    maxConcurrentWorkers?: number;
41
    maxConcurrentCallsPerWorker?: number;
42
    maxConcurrentCalls?: number;
43
    maxCallTime?: number;
44
    maxRetries?: number;
45
    autoStart?: boolean;
46
    workerOptions?: ForkOptions;
47
  }
48
49
  export type WorkerCallback =
50
    | WorkerCallback0
51
    | WorkerCallback1
52
    | WorkerCallback2
53
    | WorkerCallback3
54
    | WorkerCallback4;
55
}