public async Task ReleaseLockAsync(string blockchainType, string address, Guid transactionId) { var partitionKey = SourceAddressLockEntity.GetPartitionKey(blockchainType, address); var rowKey = SourceAddressLockEntity.GetRowKey(address); await _storage.DeleteIfExistAsync( partitionKey, rowKey, // Exactly the given transaction should own current lock to remove it lockEntity => lockEntity.OwnerTransactionId == transactionId); }
public async Task <bool> TryGetLockAsync(string blockchainType, string address, Guid transactionId) { var partitionKey = SourceAddressLockEntity.GetPartitionKey(blockchainType, address); var rowKey = SourceAddressLockEntity.GetRowKey(address); var lockEntity = await _storage.GetOrInsertAsync(partitionKey, rowKey, () => new SourceAddressLockEntity { PartitionKey = partitionKey, RowKey = rowKey, OwnerTransactionId = transactionId }); return(lockEntity.OwnerTransactionId == transactionId); }