Files
factorio-clusterio/plugins/subspace_storage/info.ts
T
Hornwitser ffe5040644 Implement autosaving of data held in memory
Add controller.autosave_interval config that specifies the frequency
which controller config, hosts, instances, users, mod packs and plugin
specific data which is held in memory should be automatically flushed to
disk if they have changed since the last time they were saved.  This
prevents data loss in the event of a server crash.

Plugins can use the onSaveData hook to save its own data at the same
time as the controller does and this obsoletes making an autosave
interval in the plugin.

Resolves #523.
2023-11-29 20:18:50 +01:00

63 lines
1.9 KiB
TypeScript

import * as lib from "@clusterio/lib";
import * as messages from "./messages";
class ControllerConfigGroup extends lib.PluginConfigGroup {}
ControllerConfigGroup.defaultAccess = ["controller", "host", "control"];
ControllerConfigGroup.groupName = "subspace_storage";
ControllerConfigGroup.define({
name: "division_method",
title: "Division Method",
description: "Method for dividing resource requests between instances.",
type: "string",
enum: ["simple", "dole", "neural_dole"],
initial_value: "simple",
});
ControllerConfigGroup.define({
name: "log_item_transfers",
title: "Log Item Transfers",
description: "Spam controller console with item transfers done.",
type: "boolean",
initial_value: false,
});
ControllerConfigGroup.finalize();
class InstanceConfigGroup extends lib.PluginConfigGroup {}
InstanceConfigGroup.defaultAccess = ["controller", "host", "control"];
InstanceConfigGroup.groupName = "subspace_storage";
InstanceConfigGroup.define({
name: "log_item_transfers",
title: "Log Item Transfers",
description: "Spam host console with item transfers done.",
type: "boolean",
initial_value: false,
});
InstanceConfigGroup.finalize();
lib.definePermission({
name: "subspace_storage.storage.view",
title: "View Subspace Storage",
description: "View the items and fluids stored in the shared subspace.",
grantByDefault: true,
});
export default {
name: "subspace_storage",
title: "Subspace Storage",
description: "Provides shared storage across instances for the Subspace Storage mod",
instanceEntrypoint: "dist/plugin/instance",
InstanceConfigGroup,
controllerEntrypoint: "dist/plugin/controller",
ControllerConfigGroup,
messages: [
messages.PlaceEvent,
messages.RemoveRequest,
messages.GetStorageRequest,
messages.UpdateStorageEvent,
messages.SetStorageSubscriptionRequest,
],
webEntrypoint: "./web",
routes: ["/storage"],
} satisfies lib.PluginDeclaration;