Add save listing and subscriptions

Add link messages for listing saves and listening for changes to the
list of saves for instances along with a table in the instance view page
showing the save list for the instance and a list-saves command to ctl.
This commit is contained in:
Hornwitser committed 2021-06-01 11:22:22 +02:00
1 parent b53ed7f6ca
commit a96fae5ffd
16 files changed
+390 -3

No files matched your search

+18
View File
@@ -43,6 +43,11 @@ class ControlConnection extends BaseConnection {
instance_ids: [],
};
this.saveListSubscriptions = {
all: false,
instance_ids: [],
};
this.logTransport = null;
this.logSubscriptions = {
all: false,
@@ -326,6 +331,19 @@ class ControlConnection extends BaseConnection {
}
}
async setSaveListSubscriptionsRequestHandler(message) {
this.saveListSubscriptions = message.data;
}
saveListUpdate(data) {
if (
this.saveListSubscriptions.all
|| this.saveListSubscriptions.instance_ids.includes(data.instance_id)
) {
libLink.messages.saveListUpdate.send(this, data);
}
}
async setLogSubscriptionsRequestHandler(message) {
this.logSubscriptions = message.data;
this.updateLogSubscriptions();
+10
View File
@@ -383,6 +383,16 @@ class Master {
}
}
saveListUpdate(data) {
for (let controlConnection of this.wsServer.controlConnections) {
if (controlConnection.connector.closing) {
continue;
}
controlConnection.saveListUpdate(data);
}
}
async loadPlugins() {
for (let pluginInfo of this.pluginInfos) {
if (!this.config.group(pluginInfo.name).get("load_plugin")) {
+4
View File
@@ -146,6 +146,10 @@ class SlaveConnection extends BaseConnection {
libLink.messages.syncUserLists.send(this, { adminlist, banlist, whitelist });
}
async saveListUpdateEventHandler(message) {
this._master.saveListUpdate(message.data);
}
async logMessageEventHandler(message) {
this._master.clusterLogger.log({
...message.data.info,