Rename to DigestableSafeAsyncLockIoManager
MODIFY
WalletWasabi.Tests/UnitTests/IoTests.cs
WalletWasabi.Tests/UnitTests/IoTests.cs
@@ -30,7 +30,7 @@ namespace WalletWasabi.Tests.UnitTests
// Single thread file operations.
- DigestableSafeMutexIoManager ioman1 = new DigestableSafeMutexIoManager(file1);
+ DigestableSafeAsyncLockIoManager ioman1 = new DigestableSafeAsyncLockIoManager(file1);
// Delete the file if Exist.
@@ -149,7 +149,7 @@ namespace WalletWasabi.Tests.UnitTests
// Check Mutex usage on simultaneous file writes.
- DigestableSafeMutexIoManager ioman2 = new DigestableSafeMutexIoManager(file2);
+ DigestableSafeAsyncLockIoManager ioman2 = new DigestableSafeAsyncLockIoManager(file2);
await Task.Run(async () =>
{
@@ -193,7 +193,7 @@ namespace WalletWasabi.Tests.UnitTests
{
var file = Path.Combine(Common.GetWorkDir(), $"file.dat");
- DigestableSafeMutexIoManager ioman = new DigestableSafeMutexIoManager(file);
+ DigestableSafeAsyncLockIoManager ioman = new DigestableSafeAsyncLockIoManager(file);
ioman.DeleteMe();
await ioman.WriteAllLinesAsync(Array.Empty<string>());
Assert.False(File.Exists(ioman.FilePath));

MODIFY
WalletWasabi/Blockchain/Transactions/TransactionStore.cs
WalletWasabi/Blockchain/Transactions/TransactionStore.cs
@@ -18,7 +18,7 @@ namespace WalletWasabi.Blockchain.Transactions
private Dictionary<uint256, SmartTransaction> Transactions { get; set; }
private object TransactionsLock { get; set; }
- private DigestableSafeMutexIoManager TransactionsFileManager { get; set; }
+ private DigestableSafeAsyncLockIoManager TransactionsFileManager { get; set; }
private List<ITxStoreOperation> Operations { get; } = new List<ITxStoreOperation>();
private object OperationsLock { get; } = new object();
@@ -35,7 +35,7 @@ namespace WalletWasabi.Blockchain.Transactions
var fileName = Path.Combine(WorkFolderPath, "Transactions.dat");
var transactionsFilePath = Path.Combine(WorkFolderPath, fileName);
- TransactionsFileManager = new DigestableSafeMutexIoManager(transactionsFilePath);
+ TransactionsFileManager = new DigestableSafeAsyncLockIoManager(transactionsFilePath);
using (await TransactionsFileManager.AsyncLock.LockAsync().ConfigureAwait(false))
{

MODIFY
WalletWasabi/Io/DigestableSafeMutexIoManager.cs
WalletWasabi/Io/DigestableSafeMutexIoManager.cs
@@ -14,12 +14,12 @@ namespace WalletWasabi.Io
/// <summary>
/// Safely manager file operations.
/// </summary>
- public class DigestableSafeMutexIoManager : SafeAsyncLockIoManager
+ public class DigestableSafeAsyncLockIoManager : SafeAsyncLockIoManager
{
private const string DigestExtension = ".dig";
/// <param name="digestRandomIndex">Use the random index of the line to create digest faster. -1 is special value, it means the last character. If null then hash whole file.</param>
- public DigestableSafeMutexIoManager(string filePath, int? digestRandomIndex = null) : base(filePath)
+ public DigestableSafeAsyncLockIoManager(string filePath, int? digestRandomIndex = null) : base(filePath)
{
DigestRandomIndex = digestRandomIndex;

MODIFY
WalletWasabi/Stores/IndexStore.cs
WalletWasabi/Stores/IndexStore.cs
@@ -38,8 +38,8 @@ namespace WalletWasabi.Stores
private string WorkFolderPath { get; set; }
private Network Network { get; }
- private DigestableSafeMutexIoManager MatureIndexFileManager { get; set; }
- private DigestableSafeMutexIoManager ImmatureIndexFileManager { get; set; }
+ private DigestableSafeAsyncLockIoManager MatureIndexFileManager { get; set; }
+ private DigestableSafeAsyncLockIoManager ImmatureIndexFileManager { get; set; }
public SmartHeaderChain SmartHeaderChain { get; }
private FilterModel StartingFilter { get; set; }
@@ -52,9 +52,9 @@ namespace WalletWasabi.Stores
using (BenchmarkLogger.Measure())
{
var indexFilePath = Path.Combine(WorkFolderPath, "MatureIndex.dat");
- MatureIndexFileManager = new DigestableSafeMutexIoManager(indexFilePath, digestRandomIndex: -1);
+ MatureIndexFileManager = new DigestableSafeAsyncLockIoManager(indexFilePath, digestRandomIndex: -1);
var immatureIndexFilePath = Path.Combine(WorkFolderPath, "ImmatureIndex.dat");
- ImmatureIndexFileManager = new DigestableSafeMutexIoManager(immatureIndexFilePath, digestRandomIndex: -1);
+ ImmatureIndexFileManager = new DigestableSafeAsyncLockIoManager(immatureIndexFilePath, digestRandomIndex: -1);
StartingFilter = StartingFilters.GetStartingFilter(Network);
StartingHeight = StartingFilter.Header.Height;
@@ -100,7 +100,7 @@ namespace WalletWasabi.Stores
}
}
- private async Task DeleteIfDeprecatedAsync(DigestableSafeMutexIoManager ioManager)
+ private async Task DeleteIfDeprecatedAsync(DigestableSafeAsyncLockIoManager ioManager)
{
string firstLine;
using (var content = ioManager.OpenText())

Rename to DigestableSafeAsyncLockIoManager