Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Duplicati/CommandLine/Commands.cs18
-rw-r--r--Duplicati/CommandLine/Program.cs1
-rw-r--r--Duplicati/CommandLine/help.txt14
-rw-r--r--Duplicati/Library/Interface/ResultInterfaces.cs3
-rw-r--r--Duplicati/Library/Main/Controller.cs7
-rw-r--r--Duplicati/Library/Main/Duplicati.Library.Main.csproj3
-rw-r--r--Duplicati/Library/Main/Enums.cs1
-rw-r--r--Duplicati/Library/Main/Operation/VacuumHandler.cs29
-rw-r--r--Duplicati/Library/Main/ResultClasses.cs5
-rwxr-xr-xDuplicati/Server/Duplicati.Server.Serialization/Enums.cs3
-rw-r--r--Duplicati/Server/Runner.cs7
11 files changed, 83 insertions, 8 deletions
diff --git a/Duplicati/CommandLine/Commands.cs b/Duplicati/CommandLine/Commands.cs
index 8406f9678..f78c5684d 100644
--- a/Duplicati/CommandLine/Commands.cs
+++ b/Duplicati/CommandLine/Commands.cs
@@ -1041,6 +1041,24 @@ namespace Duplicati.CommandLine
return 0;
}
+
+ public static int Vacuum(
+ TextWriter outwriter,
+ Action<Duplicati.Library.Main.Controller> setup,
+ List<string> args, Dictionary<string, string> options,
+ Library.Utility.IFilter filter)
+ {
+ if (args.Count != 1)
+ return PrintWrongNumberOfArguments(outwriter, args, 1);
+
+ using (
+ var controller = new Library.Main.Controller(args[0], options, new ConsoleOutput(outwriter, options)))
+ {
+ setup(controller);
+ controller.Vacuum();
+ }
+ return 0;
+ }
}
}
diff --git a/Duplicati/CommandLine/Program.cs b/Duplicati/CommandLine/Program.cs
index 28bf6a1ac..fa94e666a 100644
--- a/Duplicati/CommandLine/Program.cs
+++ b/Duplicati/CommandLine/Program.cs
@@ -97,6 +97,7 @@ namespace Duplicati.CommandLine
knownCommands["test-filters"] = Commands.TestFilters;
knownCommands["test-filter"] = Commands.TestFilters;
knownCommands["affected"] = Commands.Affected;
+ knownCommands["vacuum"] = Commands.Vacuum;
knownCommands["system-info"] = Commands.SystemInfo;
knownCommands["systeminfo"] = Commands.SystemInfo;
diff --git a/Duplicati/CommandLine/help.txt b/Duplicati/CommandLine/help.txt
index b36101655..845d9816f 100644
--- a/Duplicati/CommandLine/help.txt
+++ b/Duplicati/CommandLine/help.txt
@@ -11,7 +11,7 @@
See duplicati.commandline.exe help <topic> for more information.
General: example, changelog
- Commands: backup, find, restore, delete, compact, test, compare, purge
+ Commands: backup, find, restore, delete, compact, test, compare, purge, vacuum
Reparing: repair, affected, list-broken-files, purge-broken-files
Debugging: debug, logging, create-report, test-filters, system-info, send-mail
Targets: %BACKENDS%
@@ -265,7 +265,13 @@ Usage: test-filters <source-path> [<options>]
Usage: affected <storage-URL> <remote-filename> [<remote-filenames>] [<options>]
Returns a report explaining what backup sets and files are affected by a remote file. You can use this option to see what source files are affected if one or more remote files are damaged or deleted.
-
+
+# =============================================================================
+> duplicati.commandline.exe help vacuum
+
+Usage: vacuum <storage-URL> [<options>]
+
+ Rebuilds the local database, repacking it into a minimal amount of disk space.
# =============================================================================
> duplicati.commandline.exe help debug
@@ -462,9 +468,7 @@ Duplicati can send email notifications after each operation. Use the send-mail c
The backend url
%LOCALPATH%
The path to the local folders involved (i.e. the folders being backed up)
-
-
-
+
# =============================================================================
> duplicati.commandline.exe help advanced
> duplicati.commandline.exe help option
diff --git a/Duplicati/Library/Interface/ResultInterfaces.cs b/Duplicati/Library/Interface/ResultInterfaces.cs
index abdb11cbb..3e582c304 100644
--- a/Duplicati/Library/Interface/ResultInterfaces.cs
+++ b/Duplicati/Library/Interface/ResultInterfaces.cs
@@ -325,5 +325,8 @@ namespace Duplicati.Library.Interface
IEnumerable<string> Lines { get; }
}
+ public interface IVacuumResults : IBasicResults
+ {
+ }
}
diff --git a/Duplicati/Library/Main/Controller.cs b/Duplicati/Library/Main/Controller.cs
index 5c75d6d63..5cc0110b6 100644
--- a/Duplicati/Library/Main/Controller.cs
+++ b/Duplicati/Library/Main/Controller.cs
@@ -496,6 +496,13 @@ namespace Duplicati.Library.Main
});
}
+ public Library.Interface.IVacuumResults Vacuum()
+ {
+ return RunAction(new VacuumResult(), result => {
+ new Operation.VacuumHandler(m_options, result).Run();
+ });
+ }
+
private T RunAction<T>(T result, Action<T> method)
where T : ISetCommonOptions, ITaskControl, Logging.ILog
{
diff --git a/Duplicati/Library/Main/Duplicati.Library.Main.csproj b/Duplicati/Library/Main/Duplicati.Library.Main.csproj
index 8d7fa043a..b63d02029 100644
--- a/Duplicati/Library/Main/Duplicati.Library.Main.csproj
+++ b/Duplicati/Library/Main/Duplicati.Library.Main.csproj
@@ -45,6 +45,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
+ <Compile Include="Operation\VacuumHandler.cs" />
<Compile Include="Options.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Database\ILocalFileEntry.cs" />
@@ -178,4 +179,4 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
-</Project>
+</Project> \ No newline at end of file
diff --git a/Duplicati/Library/Main/Enums.cs b/Duplicati/Library/Main/Enums.cs
index f9eb947f0..b3de3d83d 100644
--- a/Duplicati/Library/Main/Enums.cs
+++ b/Duplicati/Library/Main/Enums.cs
@@ -48,6 +48,7 @@ namespace Duplicati.Library.Main
PurgeBrokenFiles,
PurgeFiles,
SendMail,
+ Vacuum,
}
/// <summary>
diff --git a/Duplicati/Library/Main/Operation/VacuumHandler.cs b/Duplicati/Library/Main/Operation/VacuumHandler.cs
new file mode 100644
index 000000000..454366667
--- /dev/null
+++ b/Duplicati/Library/Main/Operation/VacuumHandler.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Duplicati.Library.Main.Operation
+{
+ internal class VacuumHandler
+ {
+ private Options m_options;
+ private VacuumResult m_result;
+
+ public VacuumHandler(Options options, VacuumResult result)
+ {
+ m_options = options;
+ m_result = result;
+ }
+
+ public virtual void Run()
+ {
+ using (var db = new Database.LocalDatabase(m_options.Dbpath, "Vacuum", false))
+ {
+ m_result.SetDatabase(db);
+ db.Vacuum();
+ }
+ }
+ }
+}
diff --git a/Duplicati/Library/Main/ResultClasses.cs b/Duplicati/Library/Main/ResultClasses.cs
index 4aa92c5b6..97d7eed70 100644
--- a/Duplicati/Library/Main/ResultClasses.cs
+++ b/Duplicati/Library/Main/ResultClasses.cs
@@ -1170,5 +1170,10 @@ namespace Duplicati.Library.Main
public override OperationMode MainOperation { get { return OperationMode.SendMail; } }
public IEnumerable<string> Lines { get; set; }
}
+
+ internal class VacuumResult : BasicResults, IVacuumResults
+ {
+ public override OperationMode MainOperation { get { return OperationMode.Vacuum; } }
+ }
}
diff --git a/Duplicati/Server/Duplicati.Server.Serialization/Enums.cs b/Duplicati/Server/Duplicati.Server.Serialization/Enums.cs
index b939fe375..463fc79f9 100755
--- a/Duplicati/Server/Duplicati.Server.Serialization/Enums.cs
+++ b/Duplicati/Server/Duplicati.Server.Serialization/Enums.cs
@@ -50,7 +50,8 @@ namespace Duplicati.Server.Serialization
CreateReport,
ListRemote,
Delete,
- CustomRunner
+ Vacuum,
+ CustomRunner,
}
public enum SuggestedStatusIcon
diff --git a/Duplicati/Server/Runner.cs b/Duplicati/Server/Runner.cs
index 8be4a5b85..dc4a93aa6 100644
--- a/Duplicati/Server/Runner.cs
+++ b/Duplicati/Server/Runner.cs
@@ -655,7 +655,12 @@ namespace Duplicati.Server
Program.Scheduler.Reschedule();
return null;
}
-
+ case DuplicatiOperation.Vacuum:
+ {
+ var r = controller.Vacuum();
+ UpdateMetadata(backup, r);
+ return r;
+ }
default:
//TODO: Log this
return null;