Merge pull request #3975 from tygill/feature/fileset-temp-disk
Store fileset in a temp file instead of a memory stream
This commit is contained in:
@@ -291,7 +291,7 @@ namespace Duplicati.Library.Main
|
||||
new CommandLineArgument("asynchronous-upload-limit", CommandLineArgument.ArgumentType.Integer, Strings.Options.AsynchronousuploadlimitShort, Strings.Options.AsynchronousuploadlimitLong, "4"),
|
||||
new CommandLineArgument("asynchronous-concurrent-upload-limit", CommandLineArgument.ArgumentType.Integer, Strings.Options.AsynchronousconcurrentuploadlimitShort, Strings.Options.AsynchronousconcurrentuploadlimitLong, "4"),
|
||||
new CommandLineArgument("asynchronous-upload-folder", CommandLineArgument.ArgumentType.Path, Strings.Options.AsynchronousuploadfolderShort, Strings.Options.AsynchronousuploadfolderLong, System.IO.Path.GetTempPath()),
|
||||
|
||||
|
||||
new CommandLineArgument("disable-streaming-transfers", CommandLineArgument.ArgumentType.Boolean, Strings.Options.DisableStreamingShort, Strings.Options.DisableStreamingLong, "false"),
|
||||
|
||||
new CommandLineArgument("throttle-upload", CommandLineArgument.ArgumentType.Size, Strings.Options.ThrottleuploadShort, Strings.Options.ThrottleuploadLong, "0kb"),
|
||||
@@ -1097,7 +1097,7 @@ namespace Duplicati.Library.Main
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the logfile filename
|
||||
/// </summary>
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Duplicati.Library.Main.Strings
|
||||
public static string EncryptionmoduleLong { get { return LC.L(@"Duplicati supports pluggable encryption modules. Use this option to select a module to use for encryption. This is only applied when creating new volumes, when reading an existing file, the filename is used to select the encryption module."); } }
|
||||
public static string EncryptionmoduleShort { get { return LC.L(@"Select what module to use for encryption"); } }
|
||||
public static string DisablemoduleLong { get { return LC.L(@"Supply one or more module names, separated by commas to unload them"); } }
|
||||
public static string DisablemoduleShort { get { return LC.L(@"Disabled one or more modules"); } }
|
||||
public static string DisablemoduleShort { get { return LC.L(@"Disables one or more modules"); } }
|
||||
public static string EnablemoduleLong { get { return LC.L(@"Supply one or more module names, separated by commas to load them"); } }
|
||||
public static string EnablemoduleShort { get { return LC.L(@"Enables one or more modules"); } }
|
||||
public static string SnapshotpolicyLong { get { return LC.L(@"This setting controls the usage of snapshots, which allows Duplicati to backup files that are locked by other programs. If this is set to ""off"", Duplicati will not attempt to create a disk snapshot. Setting this to ""auto"" makes Duplicati attempt to create a snapshot, and fail silently if that was not allowed or supported (note that the OS may still log system warnings). A setting of ""on"" will also make Duplicati attempt to create a snapshot, but will produce a warning message in the log if it fails. Setting it to ""required"" will make Duplicati abort the backup if the snapshot creation fails. On windows this uses the Volume Shadow Copy Services (VSS) and requires administrative privileges. On Linux this uses Logical Volume Management (LVM) and requires root privileges."); } }
|
||||
|
||||
@@ -8,7 +8,8 @@ namespace Duplicati.Library.Main.Volumes
|
||||
{
|
||||
public class FilesetVolumeWriter : VolumeWriterBase
|
||||
{
|
||||
private readonly MemoryStream m_memorystream;
|
||||
private readonly Library.Utility.TempFile m_tempFile;
|
||||
private readonly Stream m_tempStream;
|
||||
private StreamWriter m_streamwriter;
|
||||
private readonly JsonWriter m_writer;
|
||||
private long m_filecount;
|
||||
@@ -19,8 +20,9 @@ namespace Duplicati.Library.Main.Volumes
|
||||
public FilesetVolumeWriter(Options options, DateTime timestamp)
|
||||
: base(options, timestamp)
|
||||
{
|
||||
m_memorystream = new MemoryStream();
|
||||
m_streamwriter = new StreamWriter(m_memorystream, ENCODING);
|
||||
m_tempFile = new Library.Utility.TempFile();
|
||||
m_tempStream = File.Open(m_tempFile, FileMode.Create, FileAccess.ReadWrite);
|
||||
m_streamwriter = new StreamWriter(m_tempStream, ENCODING);
|
||||
m_writer = new JsonTextWriter(m_streamwriter);
|
||||
m_writer.WriteStartArray();
|
||||
}
|
||||
@@ -138,6 +140,16 @@ namespace Duplicati.Library.Main.Volumes
|
||||
m_streamwriter = null;
|
||||
}
|
||||
|
||||
if (m_tempStream != null)
|
||||
{
|
||||
m_tempStream.Dispose();
|
||||
}
|
||||
|
||||
if (m_tempFile != null)
|
||||
{
|
||||
m_tempFile.Dispose();
|
||||
}
|
||||
|
||||
base.Close();
|
||||
}
|
||||
|
||||
@@ -149,8 +161,8 @@ namespace Duplicati.Library.Main.Volumes
|
||||
|
||||
using (Stream sr = m_compression.CreateFile(FILELIST, CompressionHint.Compressible, DateTime.UtcNow))
|
||||
{
|
||||
m_memorystream.Seek(0, SeekOrigin.Begin);
|
||||
m_memorystream.CopyTo(sr);
|
||||
m_tempStream.Seek(0, SeekOrigin.Begin);
|
||||
m_tempStream.CopyTo(sr);
|
||||
sr.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user