Enabled streaming and multithreading in encryption by default
This commit is contained in:
@@ -37,6 +37,11 @@ namespace Duplicati.Library.Encryption
|
||||
/// </summary>
|
||||
private const string COMMANDLINE_SET_THREADLEVEL = "aes-set-threadlevel";
|
||||
|
||||
/// <summary>
|
||||
/// The default thread level
|
||||
/// </summary>
|
||||
private static readonly string DEFAULT_THREAD_LEVEL = Math.Min(4, Environment.ProcessorCount).ToString();
|
||||
|
||||
/// <summary>
|
||||
/// The key used to encrypt the data
|
||||
/// </summary>
|
||||
@@ -71,18 +76,17 @@ namespace Duplicati.Library.Encryption
|
||||
m_key = passphrase;
|
||||
|
||||
string strTL;
|
||||
if (options != null && options.TryGetValue(COMMANDLINE_SET_THREADLEVEL, out strTL))
|
||||
options.TryGetValue(COMMANDLINE_SET_THREADLEVEL, out strTL);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(strTL))
|
||||
strTL = DEFAULT_THREAD_LEVEL;
|
||||
|
||||
int useTL;
|
||||
if (int.TryParse(strTL, out useTL))
|
||||
{
|
||||
int useTL;
|
||||
if (int.TryParse(strTL, out useTL))
|
||||
{
|
||||
// finally set thread level in a range of 0 (default) to 4
|
||||
m_usethreadlevel = Math.Max(0, (Math.Min(4, useTL)));
|
||||
}
|
||||
// finally set thread level in a range of 0 (default) to 4
|
||||
m_usethreadlevel = Math.Max(0, (Math.Min(4, useTL)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region IEncryption Members
|
||||
@@ -163,7 +167,7 @@ namespace Duplicati.Library.Encryption
|
||||
CommandLineArgument.ArgumentType.Enumeration,
|
||||
Strings.AESEncryption.AessetthreadlevelShort,
|
||||
Strings.AESEncryption.AessetthreadlevelLong,
|
||||
"0",
|
||||
DEFAULT_THREAD_LEVEL,
|
||||
null,
|
||||
new string[] {"0", "1", "2", "3", "4"}
|
||||
),
|
||||
|
||||
@@ -995,10 +995,10 @@ namespace Duplicati.Library.Main
|
||||
|
||||
string fileHash;
|
||||
long dataSizeDownloaded;
|
||||
if (m_options.EnablePipedStreaming)
|
||||
tmpfile = coreDoGetPiping(item, useDecrypter, out dataSizeDownloaded, out fileHash);
|
||||
else
|
||||
if (m_options.DisablePipedStreaming)
|
||||
tmpfile = coreDoGetSequential(item, useDecrypter, out dataSizeDownloaded, out fileHash);
|
||||
else
|
||||
tmpfile = coreDoGetPiping(item, useDecrypter, out dataSizeDownloaded, out fileHash);
|
||||
|
||||
var duration = DateTime.Now - begin;
|
||||
Logging.Log.WriteMessage(string.Format("Downloaded {3}{0} in {1}, {2}/s", Library.Utility.Utility.FormatSizeString(dataSizeDownloaded),
|
||||
|
||||
@@ -510,7 +510,7 @@ namespace Duplicati.Library.Main
|
||||
new CommandLineArgument("repair-only-paths", CommandLineArgument.ArgumentType.Boolean, Strings.Options.RepaironlypathsShort, Strings.Options.RepaironlypathsLong, "false"),
|
||||
new CommandLineArgument("force-locale", CommandLineArgument.ArgumentType.String, Strings.Options.ForcelocaleShort, Strings.Options.ForcelocaleLong),
|
||||
|
||||
new CommandLineArgument("enable-piped-streaming", CommandLineArgument.ArgumentType.Boolean, Strings.Options.EnablepipingShort, Strings.Options.EnablepipingLong, "false"),
|
||||
new CommandLineArgument("disable-piped-streaming", CommandLineArgument.ArgumentType.Boolean, Strings.Options.DisablepipingShort, Strings.Options.DisablepipingLong, "false"),
|
||||
});
|
||||
|
||||
return lst;
|
||||
@@ -942,7 +942,7 @@ namespace Duplicati.Library.Main
|
||||
/// <summary>
|
||||
/// A value indicating if multithreaded pipes may be used for hashing and crypting on up-/downloads
|
||||
/// </summary>
|
||||
public bool EnablePipedStreaming { get { return GetBool("enable-piped-streaming"); } }
|
||||
public bool DisablePipedStreaming { get { return GetBool("disable-piped-streaming"); } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the timelimit for removal
|
||||
|
||||
@@ -205,8 +205,8 @@ namespace Duplicati.Library.Main.Strings
|
||||
public static string RepaironlypathsLong { get { return LC.L(@"Use this option to build a searchable local database which only contains path information. This option is usable for quickly building a database to locate certain content without needing to reconstruct all information. The resulting database can be searched, but cannot be used to restore data with."); } }
|
||||
public static string ForcelocaleShort { get { return LC.L(@"Force the locale setting"); } }
|
||||
public static string ForcelocaleLong { get { return LC.L(@"By default, your system locale and culture settings will be used. In some cases you may prefer to run with another locale, for example to get messages in another language. This option can be used to set the locale. Supply a blank string to choose the ""Invariant Cultute""."); } }
|
||||
public static string EnablepipingShort{ get { return LC.L(@"Handle file communication with backend using threaded pipes"); } }
|
||||
public static string EnablepipingLong { get { return LC.L(@"Use this option to enable an experimental multithreaded handling of up- and downloads, that can significantly speed up backend operations depending on the hardware you're running on and the transfer rate of your backend. This mode of operation is considered experimental and by default disabled."); } }
|
||||
public static string DisablepipingShort{ get { return LC.L(@"Handle file communication with backend using threaded pipes"); } }
|
||||
public static string DisablepipingLong { get { return LC.L(@"Use this option to disable multithreaded handling of up- and downloads, that can significantly speed up backend operations depending on the hardware you're running on and the transfer rate of your backend."); } }
|
||||
}
|
||||
|
||||
internal static class Common
|
||||
|
||||
Reference in New Issue
Block a user