pmcf 2.65.4 → 2.66.0
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/package.json +1 -1
- package/src/cluster.mjs +9 -9
- package/types/cluster.d.mts +6 -6
package/package.json
CHANGED
package/src/cluster.mjs
CHANGED
|
@@ -21,8 +21,8 @@ const ClusterTypeDefinition = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export class Cluster extends Host {
|
|
24
|
-
_masters =
|
|
25
|
-
_backups =
|
|
24
|
+
_masters = [];
|
|
25
|
+
_backups = [];
|
|
26
26
|
routerId = 100;
|
|
27
27
|
checkInterval = 60;
|
|
28
28
|
|
|
@@ -40,7 +40,7 @@ export class Cluster extends Host {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
set masters(value) {
|
|
43
|
-
this._masters.
|
|
43
|
+
this._masters.push(value);
|
|
44
44
|
value.cluster = this;
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -49,7 +49,7 @@ export class Cluster extends Host {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
set backups(value) {
|
|
52
|
-
this._backups.
|
|
52
|
+
this._backups.push(value);
|
|
53
53
|
|
|
54
54
|
value.cluster = this;
|
|
55
55
|
}
|
|
@@ -59,7 +59,7 @@ export class Cluster extends Host {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
get members() {
|
|
62
|
-
return this.masters.union(this.backups);
|
|
62
|
+
return new Set(this.masters).union(new Set(this.backups));
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
async *preparePackages(stagingDir) {
|
|
@@ -103,7 +103,9 @@ export class Cluster extends Host {
|
|
|
103
103
|
a.name.localeCompare(b.name)
|
|
104
104
|
)) {
|
|
105
105
|
cfg.push(`vrrp_instance ${cluster.name} {`);
|
|
106
|
-
cfg.push(
|
|
106
|
+
cfg.push(
|
|
107
|
+
` state ${cluster.masters.indexOf(ni) >= 0 ? "MASTER" : "BACKUP"}`
|
|
108
|
+
);
|
|
107
109
|
cfg.push(` interface ${ni.name}`);
|
|
108
110
|
|
|
109
111
|
for (const na of cluster.networkAddresses(
|
|
@@ -123,9 +125,7 @@ export class Cluster extends Host {
|
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
cfg.push(` virtual_router_id ${cluster.routerId}`);
|
|
126
|
-
cfg.push(
|
|
127
|
-
` priority ${host.priority + (cluster.masters.has(ni) ? 5 : 0)}`
|
|
128
|
-
);
|
|
128
|
+
cfg.push(` priority ${host.priority - cluster.masters.indexOf(ni)}`);
|
|
129
129
|
cfg.push(" smtp_alert");
|
|
130
130
|
cfg.push(" advert_int 5");
|
|
131
131
|
cfg.push(" authentication {");
|
package/types/cluster.d.mts
CHANGED
|
@@ -340,14 +340,14 @@ export class Cluster extends Host {
|
|
|
340
340
|
};
|
|
341
341
|
};
|
|
342
342
|
};
|
|
343
|
-
_masters:
|
|
344
|
-
_backups:
|
|
343
|
+
_masters: any[];
|
|
344
|
+
_backups: any[];
|
|
345
345
|
routerId: number;
|
|
346
346
|
checkInterval: number;
|
|
347
|
-
set masters(value:
|
|
348
|
-
get masters():
|
|
349
|
-
set backups(value:
|
|
350
|
-
get backups():
|
|
347
|
+
set masters(value: any[]);
|
|
348
|
+
get masters(): any[];
|
|
349
|
+
set backups(value: any[]);
|
|
350
|
+
get backups(): any[];
|
|
351
351
|
get members(): Set<any>;
|
|
352
352
|
preparePackages(stagingDir: any): AsyncGenerator<{
|
|
353
353
|
sources: AsyncIterable<import("content-entry").ContentEntry | import("content-entry").CollectionEntry>[];
|