mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
Implement save transfer
Add ability to move or copy saves between instances. For instances on the same slave the saves are transferred with filesystem operations, for instances on two different slaves the proxy stream interface is used to send the save via the master server.
This commit is contained in:
1 parent
2e1c1fd3c8
commit
38c249ec70
8 files changed
+405
-2
No files matched your search
@@ -659,6 +659,34 @@ instanceSaveCommands.add(new libCommand.Command({
|
||||
},
|
||||
}));
|
||||
|
||||
instanceSaveCommands.add(new libCommand.Command({
|
||||
definition: [
|
||||
"transfer <source-instance> <source-save> <target-instance> [target-save]",
|
||||
"Transfer a save between instances",
|
||||
(yargs) => {
|
||||
yargs.positional("source-instance", { describe: "Instance to transfer save from", type: "string" });
|
||||
yargs.positional("source-save", { describe: "Save to transfer.", type: "string" });
|
||||
yargs.positional("target-instance", { describe: "Instance to transfer to", type: "string" });
|
||||
yargs.positional("target-save", { describe: "Name to give transferred save.", type: "string" });
|
||||
yargs.options({
|
||||
"copy": { describe: "Copy instead of moving the save", type: "boolean", default: false },
|
||||
});
|
||||
},
|
||||
],
|
||||
handler: async function(args, control) {
|
||||
let sourceInstanceId = await libCommand.resolveInstance(control, args.sourceInstance);
|
||||
let targetInstanceId = await libCommand.resolveInstance(control, args.targetInstance);
|
||||
let result = await libLink.messages.transferSave.send(control, {
|
||||
instance_id: sourceInstanceId,
|
||||
source_save: args.sourceSave,
|
||||
target_instance_id: targetInstanceId,
|
||||
target_save: args.targetSave || args.sourceSave,
|
||||
copy: args.copy,
|
||||
});
|
||||
print(`Transferred as ${result.save} to ${args.targetInstance}.`);
|
||||
},
|
||||
}));
|
||||
|
||||
instanceSaveCommands.add(new libCommand.Command({
|
||||
definition: ["download <instance> <save>", "Download a save from an instance", (yargs) => {
|
||||
yargs.positional("instance", { describe: "Instance to download save from", type: "string" });
|
||||
|
||||
Reference in new issue
Block a user