public async Task Delete() { var data1 = new TestEntity(1, "hello 1", "p1", "r1"); var data2 = new TestEntity(2, "hello 2", "p2", "r2"); await Storage.InsertAsync(data1); await Storage.InsertAsync(data2); var deleted = await Storage.DeleteAsync("p2", "r2"); Assert.IsTrue(Equals(deleted, data2), "not equals deleted and data2"); Assert.AreEqual(1, Storage.Count()); await Storage.InsertAsync(data2); Assert.AreEqual(2, Storage.Count()); await Storage.DeleteAsync(data1); Assert.AreEqual(1, Storage.Count()); Assert.IsTrue(Equals(data2, await Storage.GetDataAsync("p2", "r2")), "not equals after delete by entity"); await Storage.InsertAsync(data1); await Storage.DeleteIfExistAsync("p1", "r1"); await Storage.DeleteIfExistAsync("p1", "r1"); Assert.AreEqual(1, Storage.Count()); Assert.IsTrue(Equals(data2, await Storage.GetDataAsync("p2", "r2")), "not equals after delete by entity"); }
public async Task DeleteIfExistAsync(IBcnCredentialsRecord credsRecord) { var byClientEntity = FirstGenerationBlockchainWalletEntity.FromBcnClientCredentials.ByClientId.Create(credsRecord); var byAssetAddressEntity = FirstGenerationBlockchainWalletEntity.FromBcnClientCredentials.ByAssetAddress.Create(credsRecord); await _bcnClientCredentialsWalletTable.DeleteIfExistAsync(byClientEntity.PartitionKey, byClientEntity.RowKey); await _bcnClientCredentialsWalletTable.DeleteIfExistAsync(byAssetAddressEntity.PartitionKey, byAssetAddressEntity.RowKey); }
public async Task ClearAllIndexes() { IEnumerable <AzureIndex> indexes = await _index.GetDataAsync(); foreach (var item in indexes) { await _index.DeleteIfExistAsync(item.PartitionKey, item.RowKey); } }
public Task RemoveAsync(IExpiryEntry entry) { return(Task.WhenAll( _tableStorage.DeleteIfExistAsync( ExpiryEntryEntity.ByClient.GeneratePartitionKey(entry.ClientId), ExpiryEntryEntity.ByClient.GenerateRowKey(entry.RequestId)), _tableStorage.DeleteIfExistAsync( ExpiryEntryEntity.ByDateTime.GeneratePartitionKey(), ExpiryEntryEntity.ByDateTime.GenerateRowKey(entry.ExpiryDateTime, entry.RequestId)))); }
public Task <bool> TryDeleteFromIncomingHistoryObservationList( string address) { var(partitionKey, rowKey) = GetKeys(address, true); return(_addresses.DeleteIfExistAsync ( partitionKey: partitionKey, rowKey: rowKey )); }
public async Task RevokeActiveIdAsync(string blockchainType, string blockchainAssetId, string hotWallet, Guid batchId) { var partitionKey = ActiveCashoutsBatchIdEntity.GeneratePartitionKey(blockchainType); var rowKey = ActiveCashoutsBatchIdEntity.GenerateRowKey(blockchainAssetId, hotWallet); await _storage.DeleteIfExistAsync(partitionKey, rowKey, e => e.BatchId == batchId); }
public async Task UnregisterWalletSubscriptionAsync(string blockchainType, string address, MonitoringSubscriptionType subscriptionType) { var partitionKey = GetPartitionKey(blockchainType, subscriptionType); var rowKey = GetRowKey(address); await _table.DeleteIfExistAsync(partitionKey, rowKey); }
public async Task DeleteAsync(string address, CurrencyType currency) { var partitionKey = GetPartitionKey(address); var rowKey = GetRowKey(currency); await _tableStorage.DeleteIfExistAsync(partitionKey, rowKey); }
public async Task Delete(string address) { if (!await _storage.DeleteIfExistAsync(ObservableWalletEntity.GeneratePartitionKey(address), ObservableWalletEntity.GenerateRowKey())) { throw new BusinessException($"Wallet {address} not exist", ErrorCode.EntityNotExist); } }
public async Task <bool> DeleteHistoryAddressIfExistsAsync(string address, HistoryAddressCategory category) { var partitionKey = GetHistoryPartitionKey(address); var rowKey = GetHistoryRowKey(category); return(await _historyAddressesStorage.DeleteIfExistAsync(partitionKey, rowKey)); }
public async Task <bool> DeleteBalanceAddressIfExistsAsync(string address) { var partitionKey = GetBalancePartitionKey(address); var rowKey = GetBalanceRowKey(); return(await _balanceAddressesStorage.DeleteIfExistAsync(partitionKey, rowKey)); }
public async Task DeleteIfExist(Guid[] operationIds) { await operationIds.ForEachAsyncSemaphore(8, operationId => _storage.DeleteIfExistAsync( UnconfirmedTransactionEntity.GeneratePartitionKey(operationId), UnconfirmedTransactionEntity.GenerateRowKey())); }
public Task TryRemoveAsync(Guid operationId) { var partitionKey = MatchingEngineCallsDeduplicationEntity.GetPartitionKey(operationId); var rowKey = MatchingEngineCallsDeduplicationEntity.GetRowKey(operationId); return(_storage.DeleteIfExistAsync(partitionKey, rowKey)); }
public async Task ReleaseAsync(DepositWalletKey key, Guid operationId) { var partitionKey = DepositWalletLockEntity.GetPartitionKey(key); var rowKey = DepositWalletLockEntity.GetRowKey(key); await _storage.DeleteIfExistAsync(partitionKey, rowKey, e => e.OperationId == operationId); }
public async Task DeleteIfExist(params Guid[] operationIds) { await operationIds.ForEachAsyncSemaphore(8, operationId => _storage.DeleteIfExistAsync( ObservableOperationEntity.ByOperationId.GeneratePartitionKey(operationId), ObservableOperationEntity.ByOperationId.GenerateRowKey())); }
public async Task DeleteAsync(string userId, string projectId) { var partitionKey = ProjectExpertEntity.GeneratePartitionKey(projectId); var rowKey = ProjectExpertEntity.GenerateRowKey(userId); await _projectExpertsTableStorage.DeleteIfExistAsync(partitionKey, rowKey); }
public async Task DeleteAsync <T>() where T : SmsSenderSettingsBase, new() { var partitionKey = SmsSenderSettingsEntity.GeneratePartitionKey(); var defaultValue = SmsSenderSettingsBase.CreateDefault <T>(); var rowKey = SmsSenderSettingsEntity.GenerateRowKey(defaultValue); await _tableStorage.DeleteIfExistAsync(partitionKey, rowKey); }
public async Task <bool> TryDeleteObservationAsync(string address) { // delete wallet if exists var existed = await _walletStorage.DeleteIfExistAsync(DepositWalletEntity.Partition(address), DepositWalletEntity.Row()); // if not deleted earlier then delete balances if (existed) { string continuation = null; do { var query = new TableQuery <DepositWalletBalanceEntity>().Where($"PartitionKey eq '{DepositWalletBalanceEntity.Partition(address)}'"); var chunk = await _walletBalanceStorage.GetDataWithContinuationTokenAsync(query, 100, continuation); var batch = new TableBatchOperation(); continuation = chunk.ContinuationToken; foreach (var balance in chunk.Entities) { batch.Delete(balance); } if (batch.Any()) { await _walletBalanceStorage.DoBatchAsync(batch); } } while (!string.IsNullOrEmpty(continuation)); } return(existed); }
public async Task DeleteAsync <TData>(IOperationExecutionInfo <TData> executionInfo) where TData : class { var entity = Convert(executionInfo); await _tableStorage.DeleteIfExistAsync( OperationExecutionInfoEntity.GeneratePartitionKey(entity.OperationName), OperationExecutionInfoEntity.GeneratePartitionKey(executionInfo.Id)); }
public async Task DeleteIfExist(params Guid[] operationIds) { foreach (var operationId in operationIds) { await _storage.DeleteIfExistAsync(ObservableOperationEntity.ByOperationId.GeneratePartitionKey(operationId), ObservableOperationEntity.ByOperationId.GenerateRowKey(operationId)); } }
public async Task DeleteIfExist(Guid[] operationIds) { foreach (var operationId in operationIds) { await _storage.DeleteIfExistAsync(UnconfirmedTransactionEntity.GeneratePartitionKey(), UnconfirmedTransactionEntity.GenerateRowKey(operationId)); } }
public async Task <bool> DeleteIfExistsAsync(string address) { return(await _table.DeleteIfExistAsync ( GetPartitionKey(address), GetRowKey(address) )); }
public async Task CompleteAsync(string clientId, string operationId) { var entity = EthererumPendingActionEntity.CreateCompleted(clientId, operationId); await _tableStorage.InsertAsync(entity); await _tableStorage.DeleteIfExistAsync(clientId, operationId); }
public async Task DeleteDialogAsync(string dialogId) { await _tableStorage.DeleteIfExistAsync(ClientDialogEntity.GeneratePartitionKey(), ClientDialogEntity.GenerateRowKey(dialogId)); var tasks = new List <Task>(); var dialogIndexes = (await _clientDialogIndex.GetDataAsync(ClientDialogEntity.GenerateDialogIndex(dialogId))).ToList(); foreach (var index in dialogIndexes) { tasks.Add(_clientDialogIndex.DeleteIfExistAsync(index.RowKey, dialogId)); tasks.Add(_clientDialogIndex.DeleteIfExistAsync(ClientDialogEntity.GenerateDialogIndex(dialogId), index.RowKey)); } tasks.Add(UnAssignGlobalDialogAsync(dialogId)); await Task.WhenAll(tasks); }
public async Task <bool> DeleteIfExistAsync(string partitionKey, string rowKey, Func <T, bool> deleteCondition) { if (await _cache.DeleteIfExistAsync(partitionKey, rowKey, deleteCondition)) { return(await _table.DeleteIfExistAsync(partitionKey, rowKey)); } return(false); }
public async Task SetMessageIdAsync(string messageId, string id) { var entity = await _tableStorage.GetDataAsync(_index, IdIndex, id); if (!string.IsNullOrEmpty(entity.MessageId)) { await _tableStorage.DeleteIfExistAsync(MessageIdIndex, entity.MessageId); } await _tableStorage.MergeAsync(SmsMessageEntity.GeneratePartitionKey(entity.Created), SmsMessageEntity.GenerateRowKey(id), messageEntity => { messageEntity.MessageId = messageId; return(messageEntity); }); var indexEntity = AzureIndex.Create(MessageIdIndex, messageId, entity); await _index.InsertAsync(indexEntity); }
public async Task DeleteAsync(string id, string messageId) { var entity = await GetAsync(id); if (entity == null) { return; } await _tableStorage.DeleteIfExistAsync(SmsMessageEntity.GeneratePartitionKey(entity.Created), SmsMessageEntity.GenerateRowKey(id)); await _index.DeleteIfExistAsync(IdIndex, id); if (!string.IsNullOrEmpty(messageId)) { await _index.DeleteIfExistAsync(MessageIdIndex, messageId); } }
public async Task DeleteAsync(string campaignId) { var partitionKey = GetPartitionKey(campaignId); var rowKey = GetRowKey(); await _table.DeleteIfExistAsync(partitionKey, rowKey); _cache.Remove(CacheKey(campaignId)); }
public Task EndTransactionAsync(Guid operationId, Guid transactionId) { var partitionKey = ActiveTransactionEntity.GetPartitionKey(operationId); var rowKey = ActiveTransactionEntity.GetRowKey(operationId); return(_storage.DeleteIfExistAsync( partitionKey, rowKey, entity => entity.TransactionId == transactionId)); }
public async Task DeleteAsync(Guid operationId) { var entity = await _table.DeleteAsync(GetPartitionKey(), GetRowKey(operationId)); // delete index if (entity != null && !string.IsNullOrEmpty(entity.Hash)) { await _tableIndex.DeleteIfExistAsync(IndexEntity.GetPartitionKeyHash(), entity.Hash); } }