Rename methods to clarify their synchronous behavior.
Since these methods no longer have the async modifier, we should not include 'Async' in their names.
This commit is contained in:
@@ -38,7 +38,7 @@ namespace Duplicati.Library.Main.Operation.Backup
|
||||
/// </summary>
|
||||
private static readonly string FILTER_LOGTAG = Logging.Log.LogTagFromType(typeof(FileEnumerationProcess));
|
||||
|
||||
public static Task Run(IEnumerable<string> sources, Snapshots.ISnapshotService snapshot, UsnJournalService journalService, FileAttributes attributeFilter, Duplicati.Library.Utility.IFilter sourcefilter, Duplicati.Library.Utility.IFilter emitfilter, Options.SymlinkStrategy symlinkPolicy, Options.HardlinkStrategy hardlinkPolicy, bool excludeemptyfolders, string[] ignorenames, string[] changedfilelist, ITaskReader taskreader)
|
||||
public static Task Run(IEnumerable<string> sources, Snapshots.ISnapshotService snapshot, UsnJournalService journalService, FileAttributes fileAttributes, Duplicati.Library.Utility.IFilter sourcefilter, Duplicati.Library.Utility.IFilter emitfilter, Options.SymlinkStrategy symlinkPolicy, Options.HardlinkStrategy hardlinkPolicy, bool excludeemptyfolders, string[] ignorenames, string[] changedfilelist, ITaskReader taskreader)
|
||||
{
|
||||
return AutomationExtensions.RunTask(
|
||||
new
|
||||
@@ -77,21 +77,21 @@ namespace Duplicati.Library.Main.Operation.Backup
|
||||
{
|
||||
}
|
||||
|
||||
return AttributeFilterAsync(null, x, fa, snapshot, sourcefilter, hardlinkPolicy, symlinkPolicy, hardlinkmap, attributeFilter, enumeratefilter, ignorenames, mixinqueue).WaitForTask().Result;
|
||||
return AttributeFilter(null, x, fa, snapshot, sourcefilter, hardlinkPolicy, symlinkPolicy, hardlinkmap, fileAttributes, enumeratefilter, ignorenames, mixinqueue).WaitForTask().Result;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Library.Utility.Utility.EnumerationFilterDelegate AttributeFilter = (root, path, attr) =>
|
||||
AttributeFilterAsync(root, path, attr, snapshot, sourcefilter, hardlinkPolicy, symlinkPolicy, hardlinkmap, attributeFilter, enumeratefilter, ignorenames, mixinqueue).WaitForTask().Result;
|
||||
Library.Utility.Utility.EnumerationFilterDelegate attributeFilter = (root, path, attr) =>
|
||||
AttributeFilter(root, path, attr, snapshot, sourcefilter, hardlinkPolicy, symlinkPolicy, hardlinkmap, fileAttributes, enumeratefilter, ignorenames, mixinqueue).WaitForTask().Result;
|
||||
|
||||
if (journalService != null)
|
||||
{
|
||||
// filter sources using USN journal, to obtain a sub-set of files / folders that may have been modified
|
||||
sources = journalService.GetModifiedSources(AttributeFilter);
|
||||
sources = journalService.GetModifiedSources(attributeFilter);
|
||||
}
|
||||
|
||||
worklist = snapshot.EnumerateFilesAndFolders(sources, AttributeFilter, (rootpath, errorpath, ex) =>
|
||||
worklist = snapshot.EnumerateFilesAndFolders(sources, attributeFilter, (rootpath, errorpath, ex) =>
|
||||
{
|
||||
Logging.Log.WriteWarningMessage(FILTER_LOGTAG, "FileAccessError", ex, "Error reported while accessing file: {0}", errorpath);
|
||||
});
|
||||
@@ -222,7 +222,7 @@ namespace Duplicati.Library.Main.Operation.Backup
|
||||
/// <param name="rootpath">The root path that initiated this enumeration.</param>
|
||||
/// <param name="path">The current path.</param>
|
||||
/// <param name="attributes">The file or folder attributes.</param>
|
||||
private static Task<bool> AttributeFilterAsync(string rootpath, string path, FileAttributes attributes, Snapshots.ISnapshotService snapshot, Library.Utility.IFilter sourcefilter, Options.HardlinkStrategy hardlinkPolicy, Options.SymlinkStrategy symlinkPolicy, Dictionary<string, string> hardlinkmap, FileAttributes attributeFilter, Duplicati.Library.Utility.IFilter enumeratefilter, string[] ignorenames, Queue<string> mixinqueue)
|
||||
private static Task<bool> AttributeFilter(string rootpath, string path, FileAttributes attributes, Snapshots.ISnapshotService snapshot, Library.Utility.IFilter sourcefilter, Options.HardlinkStrategy hardlinkPolicy, Options.SymlinkStrategy symlinkPolicy, Dictionary<string, string> hardlinkmap, FileAttributes attributeFilter, Duplicati.Library.Utility.IFilter enumeratefilter, string[] ignorenames, Queue<string> mixinqueue)
|
||||
{
|
||||
// Step 1, exclude block devices
|
||||
try
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Duplicati.Library.Main.Operation.Backup
|
||||
|
||||
await stats.AddExaminedFile(filestatsize);
|
||||
|
||||
e.MetaHashAndSize = options.StoreMetadata ? Utility.WrapMetadata(await MetadataGenerator.GenerateMetadataAsync(e.Path, e.Attributes, options, snapshot), options) : EMPTY_METADATA;
|
||||
e.MetaHashAndSize = options.StoreMetadata ? Utility.WrapMetadata(await MetadataGenerator.GenerateMetadata(e.Path, e.Attributes, options, snapshot), options) : EMPTY_METADATA;
|
||||
|
||||
var timestampChanged = e.LastWrite != e.OldModified || e.LastWrite.Ticks == 0 || e.OldModified.Ticks == 0;
|
||||
var filesizeChanged = filestatsize < 0 || e.LastFileSize < 0 || filestatsize != e.LastFileSize;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Duplicati.Library.Main.Operation.Backup
|
||||
{
|
||||
private static readonly string METALOGTAG = Logging.Log.LogTagFromType(typeof(MetadataGenerator)) + ".Metadata";
|
||||
|
||||
public static Task<Dictionary<string, string>> GenerateMetadataAsync(string path, System.IO.FileAttributes attributes, Options options, Snapshots.ISnapshotService snapshot)
|
||||
public static Task<Dictionary<string, string>> GenerateMetadata(string path, System.IO.FileAttributes attributes, Options options, Snapshots.ISnapshotService snapshot)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Duplicati.Library.Main.Operation.Backup
|
||||
|
||||
if (options.SymlinkPolicy == Options.SymlinkStrategy.Store)
|
||||
{
|
||||
var metadata = await MetadataGenerator.GenerateMetadataAsync(path, attributes, options, snapshot);
|
||||
var metadata = await MetadataGenerator.GenerateMetadata(path, attributes, options, snapshot);
|
||||
|
||||
if (!metadata.ContainsKey("CoreSymlinkTarget"))
|
||||
metadata["CoreSymlinkTarget"] = symlinkTarget;
|
||||
@@ -184,7 +184,7 @@ namespace Duplicati.Library.Main.Operation.Backup
|
||||
|
||||
if (options.StoreMetadata)
|
||||
{
|
||||
metahash = Utility.WrapMetadata(await MetadataGenerator.GenerateMetadataAsync(path, attributes, options, snapshot), options);
|
||||
metahash = Utility.WrapMetadata(await MetadataGenerator.GenerateMetadata(path, attributes, options, snapshot), options);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -334,7 +334,7 @@ namespace Duplicati.Library.Main.Operation.Common
|
||||
return RunRetryOnMain(fe, () => DoGet(fe));
|
||||
}
|
||||
|
||||
private Task ResetBackendAsync(Exception ex)
|
||||
private Task ResetBackend(Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -410,12 +410,12 @@ namespace Duplicati.Library.Main.Operation.Common
|
||||
}
|
||||
|
||||
if (!recovered)
|
||||
await ResetBackendAsync(ex).ConfigureAwait(false);
|
||||
await ResetBackend(ex).ConfigureAwait(false);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (m_options.NoConnectionReuse)
|
||||
await ResetBackendAsync(null).ConfigureAwait(false);
|
||||
await ResetBackend(null).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user