Rename Slave to Host

The role of a slave as a host for Factorio servers is not well reflected
in its name and has caused confusion among users.  Rename slave to host
to better reflect its role as a host of Factorio servers.
This commit is contained in:
Hornwitser committed 2023-02-22 15:30:51 +01:00
1 parent 70ad295a89
commit 6fc3abafd5
101 files changed
+1168 -1168

No files matched your search

+1 -1
View File
@@ -10,4 +10,4 @@ Run the following commands in the folder Clusterio is installed to:
npm install @clusterio/plugin-global_chat
npx clusteriocontroller plugin add @clusterio/plugin-global_chat
Substitute clusteriocontroller with clusterioslave or clusterioctl if this a dedicate slave or ctl installation respectively.
Substitute clusteriocontroller with clusteriohost or clusterioctl if this a dedicate host or ctl installation respectively.
+1 -1
View File
@@ -11,7 +11,7 @@ module.exports = {
messages: {
chat: new libLink.Event({
type: "global_chat:chat",
links: ["instance-slave", "slave-controller", "controller-slave", "slave-instance", "control-controller"],
links: ["instance-host", "host-controller", "controller-host", "host-instance", "control-controller"],
forwardTo: "controller",
broadcastTo: "instance",
eventProperties: {
+1 -1
View File
@@ -45,7 +45,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
async onOutput(output) {
if (output.type === "action" && output.action === "CHAT") {
if (this.slave.connector.connected) {
if (this.host.connector.connected) {
this.sendChat(output.message);
} else {
this.messageQueue.push(output.message);
+1 -1
View File
@@ -24,7 +24,7 @@ describe("global_chat plugin", function() {
let instancePlugin;
before(async function() {
instancePlugin = new instance.InstancePlugin(info, new mock.MockInstance(), new mock.MockSlave());
instancePlugin = new instance.InstancePlugin(info, new mock.MockInstance(), new mock.MockHost());
await instancePlugin.init();
});
+1 -1
View File
@@ -15,7 +15,7 @@ Run the following commands in the folder Clusterio is installed to:
npm install @clusterio/plugin-inventory_sync
npx clusteriocontroller plugin add @clusterio/plugin-inventory_sync
Substitute clusteriocontroller with clusterioslave or clusterioctl if this a dedicated slave or ctl installation respectively.
Substitute clusteriocontroller with clusteriohost or clusterioctl if this a dedicated host or ctl installation respectively.
## Method of operation
+6 -6
View File
@@ -2,7 +2,7 @@
const { libConfig, libLink, libUsers } = require("@clusterio/lib");
class ControllerConfigGroup extends libConfig.PluginConfigGroup { }
ControllerConfigGroup.defaultAccess = ["controller", "slave", "control"];
ControllerConfigGroup.defaultAccess = ["controller", "host", "control"];
ControllerConfigGroup.groupName = "inventory_sync";
ControllerConfigGroup.define({
name: "autosave_interval",
@@ -22,7 +22,7 @@ ControllerConfigGroup.define({
ControllerConfigGroup.finalize();
class InstanceConfigGroup extends libConfig.PluginConfigGroup { }
InstanceConfigGroup.defaultAccess = ["controller", "slave", "control"];
InstanceConfigGroup.defaultAccess = ["controller", "host", "control"];
InstanceConfigGroup.groupName = "inventory_sync";
InstanceConfigGroup.define({
name: "rcon_chunk_size",
@@ -57,7 +57,7 @@ module.exports = {
messages: {
acquire: new libLink.Request({
type: "inventory_sync:acquire",
links: ["instance-slave", "slave-controller"],
links: ["instance-host", "host-controller"],
forwardTo: "controller",
requestProperties: {
"instance_id": { type: "integer" },
@@ -73,7 +73,7 @@ module.exports = {
}),
release: new libLink.Request({
type: "inventory_sync:release",
links: ["instance-slave", "slave-controller"],
links: ["instance-host", "host-controller"],
forwardTo: "controller",
requestProperties: {
"instance_id": { type: "integer" },
@@ -82,7 +82,7 @@ module.exports = {
}),
upload: new libLink.Request({
type: "inventory_sync:upload",
links: ["instance-slave", "slave-controller"],
links: ["instance-host", "host-controller"],
forwardTo: "controller",
requestProperties: {
"instance_id": { type: "integer" },
@@ -92,7 +92,7 @@ module.exports = {
}),
download: new libLink.Request({
type: "inventory_sync:download",
links: ["instance-slave", "slave-controller"],
links: ["instance-host", "host-controller"],
forwardTo: "controller",
requestProperties: {
"instance_id": { type: "integer" },
+4 -4
View File
@@ -41,7 +41,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
this.disconnecting = false;
(async () => {
for (let player_name of this.playersToRelease) {
if (!this.slave.connector.connected || this.disconnecting) {
if (!this.host.connector.connected || this.disconnecting) {
return;
}
this.playersToRelease.delete(player);
@@ -63,7 +63,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
message: "Controller is temporarily unavailable",
};
if (this.slave.connector.connected && !this.disconnecting) {
if (this.host.connector.connected && !this.disconnecting) {
try {
response = {
player_name: request.player_name,
@@ -85,7 +85,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
}
async handleRelease(request) {
if (!this.slave.connector.connected) {
if (!this.host.connector.connected) {
this.playersToRelease.set(request.player_name);
}
@@ -104,7 +104,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
}
async handleUpload(player_data) {
if (!this.slave.connector.connected || this.disconnecting) {
if (!this.host.connector.connected || this.disconnecting) {
return;
}
+1 -1
View File
@@ -12,7 +12,7 @@ Run the following commands in the folder Clusterio is installed to:
npm install @clusterio/plugin-player_auth
npx clusteriocontroller plugin add @clusterio/plugin-player_auth
Substitute clusteriocontroller with clusterioslave or clusterioctl if this a dedicate slave or ctl installation respectively.
Substitute clusteriocontroller with clusteriohost or clusterioctl if this a dedicate host or ctl installation respectively.
## Controller Configuration
+3 -3
View File
@@ -3,7 +3,7 @@ let { libConfig, libLink } = require("@clusterio/lib");
class ControllerConfigGroup extends libConfig.PluginConfigGroup {}
ControllerConfigGroup.defaultAccess = ["controller", "slave", "control"];
ControllerConfigGroup.defaultAccess = ["controller", "host", "control"];
ControllerConfigGroup.groupName = "player_auth";
ControllerConfigGroup.define({
name: "code_length",
@@ -33,7 +33,7 @@ module.exports = {
messages: {
fetchPlayerCode: new libLink.Request({
type: "player_auth:fetch_player_code",
links: ["instance-slave", "slave-controller"],
links: ["instance-host", "host-controller"],
forwardTo: "controller",
requestProperties: {
"player": { type: "string" },
@@ -45,7 +45,7 @@ module.exports = {
}),
setVerifyCode: new libLink.Request({
type: "player_auth:set_verify_code",
links: ["instance-slave", "slave-controller"],
links: ["instance-host", "host-controller"],
forwardTo: "controller",
requestProperties: {
"player": { type: "string" },
+1 -1
View File
@@ -18,7 +18,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
async handleEvent(event) {
if (event.type === "open_dialog") {
if (!this.slave.connector.connected) {
if (!this.host.connector.connected) {
await this.sendRcon(`/web-login error ${event.player} login is temporarily unavailable`);
return;
}
+2 -2
View File
@@ -363,10 +363,10 @@ describe("player_auth", function() {
describe("open_dialog", async function() {
it("should call /web-login error if not connected to controller", async function() {
instancePlugin.instance.server.reset();
instancePlugin.slave.connector.connected = false;
instancePlugin.host.connector.connected = false;
await instancePlugin.handleEvent({ type: "open_dialog", player: "test" });
let command = instancePlugin.instance.server.rconCommands[0];
instancePlugin.slave.connector.connected = true;
instancePlugin.host.connector.connected = true;
assert.equal(command, "/web-login error test login is temporarily unavailable");
});
it("should call /web-login error after error from the controller", async function() {
+1 -1
View File
@@ -10,4 +10,4 @@ Run the following commands in the folder Clusterio is installed to:
npm install @clusterio/plugin-research_sync
npx clusteriocontroller plugin add @clusterio/plugin-research_sync
Substitute clusteriocontroller with clusterioslave or clusterioctl if this a dedicate slave or ctl installation respectively.
Substitute clusteriocontroller with clusteriohost or clusterioctl if this a dedicate host or ctl installation respectively.
+4 -4
View File
@@ -59,7 +59,7 @@ class ControllerPlugin extends libPlugin.BaseControllerPlugin {
this.lastProgressBroadcast = Date.now();
if (techs.length) {
this.broadcastEventToSlaves(this.info.messages.progress, { technologies: techs });
this.broadcastEventToHosts(this.info.messages.progress, { technologies: techs });
}
}
@@ -97,7 +97,7 @@ class ControllerPlugin extends libPlugin.BaseControllerPlugin {
tech.progress = null;
this.progressToBroadcast.delete(name);
this.broadcastEventToSlaves(this.info.messages.finished, { name, level: tech.level });
this.broadcastEventToHosts(this.info.messages.finished, { name, level: tech.level });
}
}
@@ -127,7 +127,7 @@ class ControllerPlugin extends libPlugin.BaseControllerPlugin {
if (progress) {
this.progressToBroadcast.add(name);
} else if (researched || baseLevel(name) !== level) {
this.broadcastEventToSlaves(this.info.messages.finished, { name, level });
this.broadcastEventToHosts(this.info.messages.finished, { name, level });
}
} else {
@@ -138,7 +138,7 @@ class ControllerPlugin extends libPlugin.BaseControllerPlugin {
if (tech.level < level || researched) {
// Send update if the unlocked level is greater
if (level - !researched > tech.level - !tech.researched) {
this.broadcastEventToSlaves(this.info.messages.finished, { name, level: level - !researched });
this.broadcastEventToHosts(this.info.messages.finished, { name, level: level - !researched });
}
tech.level = level;
tech.progress = progress;
+4 -4
View File
@@ -28,7 +28,7 @@ module.exports = {
messages: {
contribution: new libLink.Event({
type: "research_sync:contribution",
links: ["instance-slave", "slave-controller"],
links: ["instance-host", "host-controller"],
forwardTo: "controller",
eventProperties: {
"name": { type: "string" },
@@ -38,7 +38,7 @@ module.exports = {
}),
progress: new libLink.Event({
type: "research_sync:progress",
links: ["controller-slave", "slave-instance"],
links: ["controller-host", "host-instance"],
broadcastTo: "instance",
eventProperties: {
"technologies": {
@@ -57,7 +57,7 @@ module.exports = {
}),
finished: new libLink.Event({
type: "research_sync:finished",
links: ["instance-slave", "slave-controller", "controller-slave", "slave-instance"],
links: ["instance-host", "host-controller", "controller-host", "host-instance"],
forwardTo: "controller",
broadcastTo: "instance",
eventProperties: {
@@ -67,7 +67,7 @@ module.exports = {
}),
syncTechnologies: new libLink.Request({
type: "research_sync:sync_technologies",
links: ["instance-slave", "slave-controller"],
links: ["instance-host", "host-controller"],
forwardTo: "controller",
requestProperties: {
"technologies": technologies,
+1 -1
View File
@@ -10,7 +10,7 @@ Run the following commands in the folder Clusterio is installed to:
npm install @clusterio/plugin-statistics_exporter
npx clusteriocontroller plugin add @clusterio/plugin-statistics_exporter
Substitute clusteriocontroller with clusterioslave or clusterioctl if this a dedicate slave or ctl installation respectively.
Substitute clusteriocontroller with clusteriohost or clusterioctl if this a dedicate host or ctl installation respectively.
## Instance Configuration
+1 -1
View File
@@ -2,7 +2,7 @@
const { libConfig } = require("@clusterio/lib");
class InstanceConfigGroup extends libConfig.PluginConfigGroup {}
InstanceConfigGroup.defaultAccess = ["controller", "slave", "control"];
InstanceConfigGroup.defaultAccess = ["controller", "host", "control"];
InstanceConfigGroup.groupName = "statistics_exporter";
InstanceConfigGroup.define({
name: "command_timeout",
+1 -1
View File
@@ -10,4 +10,4 @@ Run the following commands in the folder Clusterio is installed to:
npm install @clusterio/plugin-subspace_storage
npx clusteriocontroller plugin add @clusterio/plugin-subspace_storage
Substitute clusteriocontroller with clusterioslave or clusterioctl if this a dedicate slave or ctl installation respectively.
Substitute clusteriocontroller with clusteriohost or clusterioctl if this a dedicate host or ctl installation respectively.
+2 -2
View File
@@ -107,7 +107,7 @@ class ControllerPlugin extends libPlugin.BaseControllerPlugin {
}
itemsToUpdate = [...itemsToUpdate.entries()];
this.broadcastEventToSlaves(this.info.messages.updateStorage, { items: itemsToUpdate });
this.broadcastEventToHosts(this.info.messages.updateStorage, { items: itemsToUpdate });
for (let link of this.subscribedControlLinks) {
this.info.messages.updateStorage.send(link, { items: itemsToUpdate });
}
@@ -142,7 +142,7 @@ class ControllerPlugin extends libPlugin.BaseControllerPlugin {
let itemsRemoved = [];
if (method === "simple") {
// Give out as much items as possible until there are 0 left. This
// might lead to one slave getting all the items and the rest nothing.
// might lead to one host getting all the items and the rest nothing.
for (let item of message.data.items) {
let count = this.items.getItemCount(item[0]);
let toRemove = Math.min(count, item[1]);
+1 -1
View File
@@ -84,7 +84,7 @@ class NeuralDole {
this.lastRequest[`${object.name}_${object.instanceID}_${object.instanceName}`] = object.count;
// 0. Number of items to give in that dose
// 1. New dole for item X
// 2. New carry for item X slave Y
// 2. New carry for item X instance Y
this.dole[object.name] = magicData[1];
this.carry[`${object.name} ${object.instanceID}`] = magicData[2];
this.debt[`${object.name} ${object.instanceID}`] = magicData[3];
+10 -10
View File
@@ -23,23 +23,23 @@ function sigmoid3(x) {
return x;
}
// DOSE - Doses items for item X slave Y
// Numreq - number of items that are requested for item X for slave Y
// DOSE - Doses items for item X instance Y
// Numreq - number of items that are requested for item X for instance Y
// Instore - number of items for item X in controller gauge (currently)
// store_last_tick -
// Number of items for item X in controller gauge at time of last tick
// dole - Current dole for item X
// carry - carry for item X slave Y
// prev_req - Numreq for previous request for item X slave Y
// carry - carry for item X instance Y
// prev_req - Numreq for previous request for item X instance Y
// * doleinfo_last -
// Object with 2 values for last "tick period": numreq - total number or
// requests for item, numslave - number of slaves requesting that item
// debt - debt for item X slave Y
// requests for item, numinstance - number of instances requesting that item
// debt - debt for item X instance Y
// Returns: Array of 3 elements
// 0.Number of items to give in that dose
// 1.New dole for item X
// 2.New carry for item X slave Y
// 2.New carry for item X instance Y
// 3.New debt
function dose(numreq, instore, store_last_tick, dole, carry, prev_req, numreq_total_adj, debt) {
numreq = Number(numreq);
@@ -98,18 +98,18 @@ function dose(numreq, instore, store_last_tick, dole, carry, prev_req, numreq_to
// TICK -
// Updates values for item X, should be called once for each item for
// each round of all slaves requesting that item Instore - number of
// each round of all instances requesting that item Instore - number of
// items for item X in controller gauge (currently)
// dole - Current dole for item X
// store_last_tick -
// Number of items for item X in controller gauge at time of last tick (not this one)
// * doleinfo_last -
// Object with 2 values for last "tick period": numreq - total number or
// requests for item, numslave - number of slaves requesting that item
// requests for item, numinstance - number of instances requesting that item
//
// * doleinfo_new -
// Object with 2 values for new "tick period": numreq - total number or
// requests for item, numslave - number of slaves requesting that item
// requests for item, numinstance - number of instances requesting that item
// Returns: Array of 2 elements
+7 -7
View File
@@ -2,7 +2,7 @@
const { libConfig, libLink, libUsers } = require("@clusterio/lib");
class ControllerConfigGroup extends libConfig.PluginConfigGroup {}
ControllerConfigGroup.defaultAccess = ["controller", "slave", "control"];
ControllerConfigGroup.defaultAccess = ["controller", "host", "control"];
ControllerConfigGroup.groupName = "subspace_storage";
ControllerConfigGroup.define({
name: "autosave_interval",
@@ -29,12 +29,12 @@ ControllerConfigGroup.define({
ControllerConfigGroup.finalize();
class InstanceConfigGroup extends libConfig.PluginConfigGroup {}
InstanceConfigGroup.defaultAccess = ["controller", "slave", "control"];
InstanceConfigGroup.defaultAccess = ["controller", "host", "control"];
InstanceConfigGroup.groupName = "subspace_storage";
InstanceConfigGroup.define({
name: "log_item_transfers",
title: "Log Item Transfers",
description: "Spam slave console with item transfers done.",
description: "Spam host console with item transfers done.",
type: "boolean",
initial_value: false,
});
@@ -78,7 +78,7 @@ module.exports = {
// XXX this should be a request to be reliable
place: new libLink.Event({
type: "subspace_storage:place",
links: ["instance-slave", "slave-controller"],
links: ["instance-host", "host-controller"],
forwardTo: "controller",
eventProperties: {
"instance_id": { type: "integer" },
@@ -87,7 +87,7 @@ module.exports = {
}),
remove: new libLink.Request({
type: "subspace_storage:remove",
links: ["instance-slave", "slave-controller"],
links: ["instance-host", "host-controller"],
forwardTo: "controller",
requestProperties: {
"instance_id": { type: "integer" },
@@ -99,7 +99,7 @@ module.exports = {
}),
getStorage: new libLink.Request({
type: "subspace_storage:get_storage",
links: ["instance-slave", "slave-controller", "control-controller"],
links: ["instance-host", "host-controller", "control-controller"],
permission: "subspace_storage.storage.view",
forwardTo: "controller",
responseProperties: {
@@ -108,7 +108,7 @@ module.exports = {
}),
updateStorage: new libLink.Event({
type: "subspace_storage:update_storage",
links: ["controller-slave", "slave-instance", "controller-control"],
links: ["controller-host", "host-instance", "controller-control"],
broadcastTo: "instance",
eventProperties: {
"items": items,
+3 -3
View File
@@ -13,7 +13,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
this.provideItems(output).catch(err => this.unexpectedError(err));
});
this.instance.server.on("ipc-subspace_storage:orders", (orders) => {
if (this.instance.status !== "running" || !this.slave.connected) {
if (this.instance.status !== "running" || !this.host.connected) {
return;
}
@@ -25,7 +25,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
async onStart() {
this.pingId = setInterval(() => {
if (!this.slave.connected) {
if (!this.host.connected) {
return; // Only ping if we are actually connected to the controller.
}
this.sendRcon(
@@ -50,7 +50,7 @@ class InstancePlugin extends libPlugin.BaseInstancePlugin {
// provide items --------------------------------------------------------------
async provideItems(items) {
if (!this.slave.connector.hasSession) {
if (!this.host.connector.hasSession) {
// For now the items are voided if the controller connection is
// down, which is no different from the previous behaviour.
if (this.instance.config.get("subspace_storage.log_item_transfers")) {