ee-core 4.1.2 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +65 -65
- package/app/application.d.ts +5 -5
- package/app/application.js +30 -30
- package/app/boot.d.ts +5 -5
- package/app/boot.js +80 -80
- package/app/dir.d.ts +1 -1
- package/app/dir.js +26 -26
- package/app/events.d.ts +14 -14
- package/app/events.js +55 -55
- package/app/index.d.ts +2 -2
- package/app/index.js +6 -6
- package/config/config_loader.d.ts +13 -13
- package/config/config_loader.js +65 -65
- package/config/default_config.d.ts +95 -95
- package/config/default_config.js +111 -111
- package/config/index.d.ts +28 -28
- package/config/index.js +24 -24
- package/const/channel.d.ts +16 -16
- package/const/channel.js +27 -27
- package/controller/controller_loader.d.ts +9 -9
- package/controller/controller_loader.js +77 -77
- package/controller/index.d.ts +2 -2
- package/controller/index.js +24 -24
- package/core/index.d.ts +2 -2
- package/core/index.js +11 -11
- package/core/loader/file_loader.d.ts +66 -66
- package/core/loader/file_loader.js +211 -211
- package/core/utils/index.d.ts +12 -12
- package/core/utils/index.js +83 -83
- package/core/utils/timing.d.ts +22 -22
- package/core/utils/timing.js +78 -78
- package/cross/cross.d.ts +19 -19
- package/cross/cross.js +151 -151
- package/cross/crossProcess.d.ts +29 -29
- package/cross/crossProcess.js +172 -172
- package/cross/index.d.ts +2 -2
- package/cross/index.js +8 -8
- package/electron/app/index.d.ts +5 -5
- package/electron/app/index.js +48 -48
- package/electron/index.d.ts +3 -3
- package/electron/index.js +15 -15
- package/electron/window/index.d.ts +6 -6
- package/electron/window/index.js +268 -268
- package/exception/index.d.ts +9 -9
- package/exception/index.js +100 -100
- package/html/boot.html +98 -98
- package/html/cross-failure.html +28 -28
- package/html/failure.html +28 -28
- package/html/index.d.ts +1 -1
- package/html/index.js +10 -10
- package/index.d.ts +2 -2
- package/index.js +6 -6
- package/jobs/child/app.d.ts +1 -1
- package/jobs/child/app.js +69 -69
- package/jobs/child/index.d.ts +13 -13
- package/jobs/child/index.js +85 -85
- package/jobs/child/jobProcess.d.ts +16 -16
- package/jobs/child/jobProcess.js +133 -133
- package/jobs/child-pool/index.d.ts +26 -26
- package/jobs/child-pool/index.js +190 -190
- package/jobs/index.d.ts +3 -3
- package/jobs/index.js +6 -6
- package/jobs/load-balancer/algorithm/index.d.ts +4 -4
- package/jobs/load-balancer/algorithm/index.js +11 -11
- package/jobs/load-balancer/algorithm/minimumConnection.d.ts +2 -2
- package/jobs/load-balancer/algorithm/minimumConnection.js +18 -18
- package/jobs/load-balancer/algorithm/polling.d.ts +2 -2
- package/jobs/load-balancer/algorithm/polling.js +11 -11
- package/jobs/load-balancer/algorithm/random.d.ts +2 -2
- package/jobs/load-balancer/algorithm/random.js +9 -9
- package/jobs/load-balancer/algorithm/specify.d.ts +2 -2
- package/jobs/load-balancer/algorithm/specify.js +14 -14
- package/jobs/load-balancer/algorithm/weights.d.ts +2 -2
- package/jobs/load-balancer/algorithm/weights.js +21 -21
- package/jobs/load-balancer/algorithm/weightsMinimumConnection.d.ts +2 -2
- package/jobs/load-balancer/algorithm/weightsMinimumConnection.js +29 -29
- package/jobs/load-balancer/algorithm/weightsPolling.d.ts +2 -2
- package/jobs/load-balancer/algorithm/weightsPolling.js +22 -22
- package/jobs/load-balancer/algorithm/weightsRandom.d.ts +2 -2
- package/jobs/load-balancer/algorithm/weightsRandom.js +16 -16
- package/jobs/load-balancer/consts.d.ts +8 -8
- package/jobs/load-balancer/consts.js +9 -9
- package/jobs/load-balancer/index.d.ts +96 -96
- package/jobs/load-balancer/index.js +201 -201
- package/jobs/load-balancer/scheduler.d.ts +16 -16
- package/jobs/load-balancer/scheduler.js +31 -31
- package/loader/index.d.ts +9 -9
- package/loader/index.js +99 -98
- package/log/index.d.ts +5 -5
- package/log/index.js +85 -85
- package/log/logger.d.ts +1 -1
- package/log/logger.js +94 -94
- package/message/childMessage.d.ts +10 -10
- package/message/childMessage.js +43 -43
- package/message/index.d.ts +3 -3
- package/message/index.js +9 -9
- package/package.json +42 -42
- package/ps/index.d.ts +39 -39
- package/ps/index.js +294 -294
- package/socket/httpServer.d.ts +8 -8
- package/socket/httpServer.js +199 -199
- package/socket/index.d.ts +10 -10
- package/socket/index.js +64 -64
- package/socket/ipcServer.d.ts +9 -9
- package/socket/ipcServer.js +105 -105
- package/socket/socketServer.d.ts +10 -10
- package/socket/socketServer.js +81 -81
- package/storage/index.d.ts +4 -4
- package/storage/index.js +6 -6
- package/storage/sqliteStorage.d.ts +16 -16
- package/storage/sqliteStorage.js +123 -123
- package/tsconfig.json +13 -13
- package/utils/extend.d.ts +2 -2
- package/utils/extend.js +77 -77
- package/utils/helper.d.ts +14 -14
- package/utils/helper.js +206 -206
- package/utils/index.d.ts +10 -10
- package/utils/index.js +167 -167
- package/utils/ip.d.ts +2 -2
- package/utils/ip.js +221 -221
- package/utils/is.d.ts +14 -14
- package/utils/is.js +111 -111
- package/utils/json.d.ts +5 -5
- package/utils/json.js +79 -79
- package/utils/pargv.d.ts +3 -3
- package/utils/pargv.js +267 -267
- package/utils/port/index.d.ts +1 -1
- package/utils/port/index.js +125 -125
- package/utils/wrap.d.ts +4 -4
- package/utils/wrap.js +40 -40
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 权重
|
|
3
|
-
*/
|
|
4
|
-
module.exports = function (tasks, weightTotal, context) {
|
|
5
|
-
|
|
6
|
-
if (!tasks.length) return null;
|
|
7
|
-
|
|
8
|
-
let max = tasks[0].weight, maxIndex = 0, sum;
|
|
9
|
-
|
|
10
|
-
for (let i = 0; i < tasks.length; i++) {
|
|
11
|
-
sum = (tasks[i].weight || 0) + Math.random() * weightTotal;
|
|
12
|
-
if (sum >= max) {
|
|
13
|
-
max = sum;
|
|
14
|
-
maxIndex = i;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
context.weightIndex += 1;
|
|
19
|
-
context.weightIndex %= (weightTotal + 1);
|
|
20
|
-
|
|
21
|
-
return tasks[maxIndex];
|
|
1
|
+
/**
|
|
2
|
+
* 权重
|
|
3
|
+
*/
|
|
4
|
+
module.exports = function (tasks, weightTotal, context) {
|
|
5
|
+
|
|
6
|
+
if (!tasks.length) return null;
|
|
7
|
+
|
|
8
|
+
let max = tasks[0].weight, maxIndex = 0, sum;
|
|
9
|
+
|
|
10
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
11
|
+
sum = (tasks[i].weight || 0) + Math.random() * weightTotal;
|
|
12
|
+
if (sum >= max) {
|
|
13
|
+
max = sum;
|
|
14
|
+
maxIndex = i;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
context.weightIndex += 1;
|
|
19
|
+
context.weightIndex %= (weightTotal + 1);
|
|
20
|
+
|
|
21
|
+
return tasks[maxIndex];
|
|
22
22
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function _exports(tasks: any, weightTotal: any, connectionsMap: any, context: any): any;
|
|
2
|
-
export = _exports;
|
|
1
|
+
declare function _exports(tasks: any, weightTotal: any, connectionsMap: any, context: any): any;
|
|
2
|
+
export = _exports;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 权重最小连接数
|
|
3
|
-
*/
|
|
4
|
-
module.exports = function (tasks, weightTotal, connectionsMap, context) {
|
|
5
|
-
|
|
6
|
-
if (!tasks.length) return null;
|
|
7
|
-
|
|
8
|
-
let min = tasks[0].weight, minIndex = 0, sum;
|
|
9
|
-
|
|
10
|
-
const connectionsTotal = tasks.reduce((total, cur) => {
|
|
11
|
-
total += (connectionsMap[cur.id] || 0);
|
|
12
|
-
return total;
|
|
13
|
-
}, 0);
|
|
14
|
-
|
|
15
|
-
// algorithm: (weight + connections'weight) + random factor
|
|
16
|
-
for (let i = 0; i < tasks.length; i++) {
|
|
17
|
-
sum =
|
|
18
|
-
(tasks[i].weight || 0) + (Math.random() * weightTotal) +
|
|
19
|
-
(( (connectionsMap[tasks[i].id] || 0) * weightTotal ) / connectionsTotal);
|
|
20
|
-
if (sum <= min) {
|
|
21
|
-
min = sum;
|
|
22
|
-
minIndex = i;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
context.weightIndex += 1;
|
|
27
|
-
context.weightIndex %= (weightTotal + 1);
|
|
28
|
-
|
|
29
|
-
return tasks[minIndex];
|
|
1
|
+
/**
|
|
2
|
+
* 权重最小连接数
|
|
3
|
+
*/
|
|
4
|
+
module.exports = function (tasks, weightTotal, connectionsMap, context) {
|
|
5
|
+
|
|
6
|
+
if (!tasks.length) return null;
|
|
7
|
+
|
|
8
|
+
let min = tasks[0].weight, minIndex = 0, sum;
|
|
9
|
+
|
|
10
|
+
const connectionsTotal = tasks.reduce((total, cur) => {
|
|
11
|
+
total += (connectionsMap[cur.id] || 0);
|
|
12
|
+
return total;
|
|
13
|
+
}, 0);
|
|
14
|
+
|
|
15
|
+
// algorithm: (weight + connections'weight) + random factor
|
|
16
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
17
|
+
sum =
|
|
18
|
+
(tasks[i].weight || 0) + (Math.random() * weightTotal) +
|
|
19
|
+
(( (connectionsMap[tasks[i].id] || 0) * weightTotal ) / connectionsTotal);
|
|
20
|
+
if (sum <= min) {
|
|
21
|
+
min = sum;
|
|
22
|
+
minIndex = i;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
context.weightIndex += 1;
|
|
27
|
+
context.weightIndex %= (weightTotal + 1);
|
|
28
|
+
|
|
29
|
+
return tasks[minIndex];
|
|
30
30
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function _exports(tasks: any, weightIndex: any, weightTotal: any, context: any): any;
|
|
2
|
-
export = _exports;
|
|
1
|
+
declare function _exports(tasks: any, weightIndex: any, weightTotal: any, context: any): any;
|
|
2
|
+
export = _exports;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 权重轮询
|
|
3
|
-
*/
|
|
4
|
-
module.exports = function (tasks, weightIndex, weightTotal, context) {
|
|
5
|
-
|
|
6
|
-
if (!tasks.length) return null;
|
|
7
|
-
|
|
8
|
-
let weight = 0;
|
|
9
|
-
let task;
|
|
10
|
-
|
|
11
|
-
for (let i = 0; i < tasks.length; i++) {
|
|
12
|
-
weight += tasks[i].weight || 0;
|
|
13
|
-
if (weight > weightIndex) {
|
|
14
|
-
task = tasks[i];
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
context.weightIndex += 1;
|
|
20
|
-
context.weightIndex %= (weightTotal + 1);
|
|
21
|
-
|
|
22
|
-
return task;
|
|
1
|
+
/**
|
|
2
|
+
* 权重轮询
|
|
3
|
+
*/
|
|
4
|
+
module.exports = function (tasks, weightIndex, weightTotal, context) {
|
|
5
|
+
|
|
6
|
+
if (!tasks.length) return null;
|
|
7
|
+
|
|
8
|
+
let weight = 0;
|
|
9
|
+
let task;
|
|
10
|
+
|
|
11
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
12
|
+
weight += tasks[i].weight || 0;
|
|
13
|
+
if (weight > weightIndex) {
|
|
14
|
+
task = tasks[i];
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
context.weightIndex += 1;
|
|
20
|
+
context.weightIndex %= (weightTotal + 1);
|
|
21
|
+
|
|
22
|
+
return task;
|
|
23
23
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function _exports(tasks: any, weightTotal: any): any;
|
|
2
|
-
export = _exports;
|
|
1
|
+
declare function _exports(tasks: any, weightTotal: any): any;
|
|
2
|
+
export = _exports;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 权重随机
|
|
3
|
-
*/
|
|
4
|
-
module.exports = function (tasks, weightTotal) {
|
|
5
|
-
let task;
|
|
6
|
-
let weight = Math.ceil(Math.random() * weightTotal);
|
|
7
|
-
|
|
8
|
-
for (let i = 0; i < tasks.length; i++) {
|
|
9
|
-
weight -= tasks[i].weight || 0;
|
|
10
|
-
if (weight <= 0) {
|
|
11
|
-
task = tasks[i];
|
|
12
|
-
break;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return task || null;
|
|
1
|
+
/**
|
|
2
|
+
* 权重随机
|
|
3
|
+
*/
|
|
4
|
+
module.exports = function (tasks, weightTotal) {
|
|
5
|
+
let task;
|
|
6
|
+
let weight = Math.ceil(Math.random() * weightTotal);
|
|
7
|
+
|
|
8
|
+
for (let i = 0; i < tasks.length; i++) {
|
|
9
|
+
weight -= tasks[i].weight || 0;
|
|
10
|
+
if (weight <= 0) {
|
|
11
|
+
task = tasks[i];
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return task || null;
|
|
17
17
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare let polling: string;
|
|
2
|
-
export declare let weights: string;
|
|
3
|
-
export declare let random: string;
|
|
4
|
-
export declare let specify: string;
|
|
5
|
-
export declare let weightsPolling: string;
|
|
6
|
-
export declare let weightsRandom: string;
|
|
7
|
-
export declare let minimumConnection: string;
|
|
8
|
-
export declare let weightsMinimumConnection: string;
|
|
1
|
+
export declare let polling: string;
|
|
2
|
+
export declare let weights: string;
|
|
3
|
+
export declare let random: string;
|
|
4
|
+
export declare let specify: string;
|
|
5
|
+
export declare let weightsPolling: string;
|
|
6
|
+
export declare let weightsRandom: string;
|
|
7
|
+
export declare let minimumConnection: string;
|
|
8
|
+
export declare let weightsMinimumConnection: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
polling: 'polling', // 轮询
|
|
3
|
-
weights: 'weights', // 权重
|
|
4
|
-
random: 'random', // 随机
|
|
5
|
-
specify: 'specify', // 声明绑定
|
|
6
|
-
weightsPolling: 'weightsPolling', // 权重轮询
|
|
7
|
-
weightsRandom: 'weightsRandom', // 权重随机
|
|
8
|
-
minimumConnection: 'minimumConnection', // 最小连接数
|
|
9
|
-
weightsMinimumConnection: 'weightsMinimumConnection', // 权重最小连接数
|
|
1
|
+
module.exports = {
|
|
2
|
+
polling: 'polling', // 轮询
|
|
3
|
+
weights: 'weights', // 权重
|
|
4
|
+
random: 'random', // 随机
|
|
5
|
+
specify: 'specify', // 声明绑定
|
|
6
|
+
weightsPolling: 'weightsPolling', // 权重轮询
|
|
7
|
+
weightsRandom: 'weightsRandom', // 权重随机
|
|
8
|
+
minimumConnection: 'minimumConnection', // 最小连接数
|
|
9
|
+
weightsMinimumConnection: 'weightsMinimumConnection', // 权重最小连接数
|
|
10
10
|
};
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
export = LoadBalancer;
|
|
2
|
-
/**
|
|
3
|
-
* 负载均衡器
|
|
4
|
-
* @intro 参考electron-re项目,并做了一些改动
|
|
5
|
-
* @since 1.0.0
|
|
6
|
-
*/
|
|
7
|
-
declare class LoadBalancer {
|
|
8
|
-
static Algorithm: {
|
|
9
|
-
polling: string;
|
|
10
|
-
weights: string;
|
|
11
|
-
random: string;
|
|
12
|
-
specify: string;
|
|
13
|
-
weightsPolling: string;
|
|
14
|
-
weightsRandom: string;
|
|
15
|
-
minimumConnection: string;
|
|
16
|
-
weightsMinimumConnection: string;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* @param {Object} options
|
|
20
|
-
* @param {Array } options.targets [ targets for load balancing calculation: [{id: 1, weight: 1}, {id: 2, weight: 2}] ]
|
|
21
|
-
* @param {String} options.algorithm
|
|
22
|
-
*/
|
|
23
|
-
constructor(options: {
|
|
24
|
-
targets: any[];
|
|
25
|
-
algorithm: string;
|
|
26
|
-
});
|
|
27
|
-
targets: any[];
|
|
28
|
-
algorithm: string;
|
|
29
|
-
params: {
|
|
30
|
-
currentIndex: number;
|
|
31
|
-
weightIndex: number;
|
|
32
|
-
weightTotal: number;
|
|
33
|
-
connectionsMap: {};
|
|
34
|
-
cpuOccupancyMap: {};
|
|
35
|
-
memoryOccupancyMap: {};
|
|
36
|
-
};
|
|
37
|
-
scheduler: Scheduler;
|
|
38
|
-
memoParams: {
|
|
39
|
-
[x: string]: (id: any) => any[];
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* 算法参数
|
|
43
|
-
*/
|
|
44
|
-
memorizedParams(): {
|
|
45
|
-
[x: string]: (id: any) => any[];
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* 刷新参数
|
|
49
|
-
*/
|
|
50
|
-
refreshParams(pidMap: any): void;
|
|
51
|
-
/**
|
|
52
|
-
* 选举出一个进程
|
|
53
|
-
*/
|
|
54
|
-
pickOne(...params: any[]): any;
|
|
55
|
-
/**
|
|
56
|
-
* 选举出多个进程
|
|
57
|
-
*/
|
|
58
|
-
pickMulti(count?: number, ...params: any[]): any[];
|
|
59
|
-
/**
|
|
60
|
-
* 计算权重
|
|
61
|
-
*/
|
|
62
|
-
calculateWeightIndex(): void;
|
|
63
|
-
/**
|
|
64
|
-
* 计算索引
|
|
65
|
-
*/
|
|
66
|
-
calculateIndex(): void;
|
|
67
|
-
/**
|
|
68
|
-
* 清除data
|
|
69
|
-
*/
|
|
70
|
-
clean(id: any): void;
|
|
71
|
-
/**
|
|
72
|
-
* 添加一个进程信息
|
|
73
|
-
*/
|
|
74
|
-
add(task: any): void;
|
|
75
|
-
/**
|
|
76
|
-
* 删除一个进程信息
|
|
77
|
-
*/
|
|
78
|
-
del(target: any): void;
|
|
79
|
-
/**
|
|
80
|
-
* 擦除
|
|
81
|
-
*/
|
|
82
|
-
wipe(): void;
|
|
83
|
-
/**
|
|
84
|
-
* 更新计算参数
|
|
85
|
-
*/
|
|
86
|
-
updateParams(object: any): void;
|
|
87
|
-
/**
|
|
88
|
-
* 设置targets
|
|
89
|
-
*/
|
|
90
|
-
setTargets(targets: any): void;
|
|
91
|
-
/**
|
|
92
|
-
* 设置算法
|
|
93
|
-
*/
|
|
94
|
-
setAlgorithm: (algorithm: any) => void;
|
|
95
|
-
}
|
|
96
|
-
import Scheduler = require("./scheduler");
|
|
1
|
+
export = LoadBalancer;
|
|
2
|
+
/**
|
|
3
|
+
* 负载均衡器
|
|
4
|
+
* @intro 参考electron-re项目,并做了一些改动
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
declare class LoadBalancer {
|
|
8
|
+
static Algorithm: {
|
|
9
|
+
polling: string;
|
|
10
|
+
weights: string;
|
|
11
|
+
random: string;
|
|
12
|
+
specify: string;
|
|
13
|
+
weightsPolling: string;
|
|
14
|
+
weightsRandom: string;
|
|
15
|
+
minimumConnection: string;
|
|
16
|
+
weightsMinimumConnection: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @param {Object} options
|
|
20
|
+
* @param {Array } options.targets [ targets for load balancing calculation: [{id: 1, weight: 1}, {id: 2, weight: 2}] ]
|
|
21
|
+
* @param {String} options.algorithm
|
|
22
|
+
*/
|
|
23
|
+
constructor(options: {
|
|
24
|
+
targets: any[];
|
|
25
|
+
algorithm: string;
|
|
26
|
+
});
|
|
27
|
+
targets: any[];
|
|
28
|
+
algorithm: string;
|
|
29
|
+
params: {
|
|
30
|
+
currentIndex: number;
|
|
31
|
+
weightIndex: number;
|
|
32
|
+
weightTotal: number;
|
|
33
|
+
connectionsMap: {};
|
|
34
|
+
cpuOccupancyMap: {};
|
|
35
|
+
memoryOccupancyMap: {};
|
|
36
|
+
};
|
|
37
|
+
scheduler: Scheduler;
|
|
38
|
+
memoParams: {
|
|
39
|
+
[x: string]: (id: any) => any[];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* 算法参数
|
|
43
|
+
*/
|
|
44
|
+
memorizedParams(): {
|
|
45
|
+
[x: string]: (id: any) => any[];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* 刷新参数
|
|
49
|
+
*/
|
|
50
|
+
refreshParams(pidMap: any): void;
|
|
51
|
+
/**
|
|
52
|
+
* 选举出一个进程
|
|
53
|
+
*/
|
|
54
|
+
pickOne(...params: any[]): any;
|
|
55
|
+
/**
|
|
56
|
+
* 选举出多个进程
|
|
57
|
+
*/
|
|
58
|
+
pickMulti(count?: number, ...params: any[]): any[];
|
|
59
|
+
/**
|
|
60
|
+
* 计算权重
|
|
61
|
+
*/
|
|
62
|
+
calculateWeightIndex(): void;
|
|
63
|
+
/**
|
|
64
|
+
* 计算索引
|
|
65
|
+
*/
|
|
66
|
+
calculateIndex(): void;
|
|
67
|
+
/**
|
|
68
|
+
* 清除data
|
|
69
|
+
*/
|
|
70
|
+
clean(id: any): void;
|
|
71
|
+
/**
|
|
72
|
+
* 添加一个进程信息
|
|
73
|
+
*/
|
|
74
|
+
add(task: any): void;
|
|
75
|
+
/**
|
|
76
|
+
* 删除一个进程信息
|
|
77
|
+
*/
|
|
78
|
+
del(target: any): void;
|
|
79
|
+
/**
|
|
80
|
+
* 擦除
|
|
81
|
+
*/
|
|
82
|
+
wipe(): void;
|
|
83
|
+
/**
|
|
84
|
+
* 更新计算参数
|
|
85
|
+
*/
|
|
86
|
+
updateParams(object: any): void;
|
|
87
|
+
/**
|
|
88
|
+
* 设置targets
|
|
89
|
+
*/
|
|
90
|
+
setTargets(targets: any): void;
|
|
91
|
+
/**
|
|
92
|
+
* 设置算法
|
|
93
|
+
*/
|
|
94
|
+
setAlgorithm: (algorithm: any) => void;
|
|
95
|
+
}
|
|
96
|
+
import Scheduler = require("./scheduler");
|