Implemented the missing details for the concurrent setup, it now compiles
This commit is contained in:
@@ -799,13 +799,12 @@ namespace Duplicati.Library.Main.Database
|
||||
}
|
||||
}
|
||||
|
||||
public object SafeDeleteRemoteVolume(string name, System.Data.IDbTransaction transaction)
|
||||
public void SafeDeleteRemoteVolume(string name, System.Data.IDbTransaction transaction)
|
||||
{
|
||||
var volumeid = GetRemoteVolumeID(name, transaction);
|
||||
|
||||
using(var cmd = m_connection.CreateCommand())
|
||||
using(var cmd = m_connection.CreateCommand(transaction))
|
||||
{
|
||||
cmd.Transaction = transaction;
|
||||
var c = cmd.ExecuteNonQuery(@"SELECT COUNT(*) FROM ""Block"" WHERE ""VolumeID"" = ? ", volumeid);
|
||||
if (c != 0)
|
||||
throw new Exception(string.Format("Failed to safe-delete volume {0}, blocks: {1}", name, c));
|
||||
@@ -813,5 +812,18 @@ namespace Duplicati.Library.Main.Database
|
||||
RemoveRemoteVolume(name, transaction);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetBlocklistHashes(string name, System.Data.IDbTransaction transaction)
|
||||
{
|
||||
var volumeid = GetRemoteVolumeID(name, transaction);
|
||||
using(var cmd = m_connection.CreateCommand(transaction))
|
||||
{
|
||||
// Grab the strings and return as array to avoid concurrent access to the IEnumerable
|
||||
return cmd.ExecuteReaderEnumerable(
|
||||
@"SELECT DISTINCT ""Block"".""Hash"" FROM ""Block"" WHERE ""Block"".""VolumeID"" = ? AND ""Block"".""Hash"" IN (SELECT ""Hash"" FROM ""BlocklistHash"")", volumeid)
|
||||
.Select(x => x.ConvertValueToString(0))
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,6 @@
|
||||
<Compile Include="Operation\Backup\FilePreFilterProcess.cs" />
|
||||
<Compile Include="Operation\Backup\DataBlockProcessor.cs" />
|
||||
<Compile Include="Operation\Common\BackendOperation.cs" />
|
||||
<Compile Include="Operation\BackendProcess.cs" />
|
||||
<Compile Include="Operation\Backup\SpillCollectorProcess.cs" />
|
||||
<Compile Include="Operation\Backup\BackupDatabase.cs" />
|
||||
<Compile Include="Operation\Common\DatabaseCommon.cs" />
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
// Copyright (C) 2015, The Duplicati Team
|
||||
// http://www.duplicati.com, info@duplicati.com
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 2.1 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
using System;
|
||||
using CoCoL;
|
||||
using System.Threading.Tasks;
|
||||
using Duplicati.Library.Main.Operation.Common;
|
||||
|
||||
namespace Duplicati.Library.Main.Operation
|
||||
{
|
||||
internal static class BackendProcess
|
||||
{
|
||||
public static Task Run()
|
||||
{
|
||||
return AutomationExtensions.RunTask(
|
||||
new
|
||||
{
|
||||
LogChannel = ChannelMarker.ForWrite<LogMessage>("LogChannel"),
|
||||
Input = ChannelMarker.ForRead<IBackendOperation>("BackendRequests"),
|
||||
},
|
||||
|
||||
async self =>
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
var request = await self.Input.ReadAsync();
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Duplicati.Library.Main.Operation.Backup
|
||||
|
||||
public Task SafeDeleteRemoteVolumeAsync(string remotename)
|
||||
{
|
||||
return RunOnMain(() => Task.FromResult(m_database.SafeDeleteRemoteVolume(remotename, m_transaction)));
|
||||
return RunOnMain(() => m_database.SafeDeleteRemoteVolume(remotename, m_transaction));
|
||||
}
|
||||
|
||||
public Task<IEnumerable<string>> GetBlocklistHashesAsync(string remotename)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Duplicati.Library.Main.Operation.Backup
|
||||
private BackupResults m_res;
|
||||
|
||||
public BackupStatsCollector(BackupResults res)
|
||||
: base(res)
|
||||
: base(res.BackendWriter)
|
||||
{
|
||||
m_res = res;
|
||||
}
|
||||
|
||||
@@ -267,14 +267,14 @@ namespace Duplicati.Library.Main.Operation.Common
|
||||
});
|
||||
}
|
||||
|
||||
public Task<Library.Utility.TempFile> GetFileForTestingAsync(string remotename, long size, string remotehash)
|
||||
/*public Task<Library.Utility.TempFile> GetFileForTestingAsync(string remotename, long size, string remotehash)
|
||||
{
|
||||
var fe = new FileEntryItem(BackendActionType.Get, remotename, null);
|
||||
return RunRetryOnMain(fe, async() =>
|
||||
{
|
||||
|
||||
});
|
||||
}
|
||||
}*/
|
||||
|
||||
private async Task ResetBackendAsync(Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user