public async Task SetTxHashAsync(Guid operationId, string txHash) { var entities = await _storage.GetDataAsync(InternalOutputEntity.GeneratePartitionKey(operationId)); foreach (var internalOutputEntity in entities) { var updatedEntity = await _storage.ReplaceAsync(InternalOutputEntity.GeneratePartitionKey(operationId), InternalOutputEntity.GenerateRowKey(internalOutputEntity.N), entity => { entity.TransactionHash = txHash; return(entity); }); await _indexByAddress.InsertOrReplaceAsync(IndexByAddress.Create(updatedEntity)); await _indexByTransactionHash.InsertOrReplaceAsync(IndexByTransactionHash.Create(updatedEntity)); } }
public async Task RemoveOutputsAsync(IEnumerable <IOutput> outputs) { foreach (var output in outputs) { var index = await _indexByTransactionHash.GetDataAsync( IndexByTransactionHash.GeneratePartitionKey(output.TransactionHash), IndexByTransactionHash.GenerateRowKey(output.N)); if (index != null) { var entity = await _storage.DeleteAsync(index); if (entity != null) { await _indexByAddress.DeleteAsync(IndexByAddress.GeneratePartitionKey(entity.Address), IndexByAddress.GenerateRowKey(entity.TransactionHash, entity.N)); } await _indexByTransactionHash.DeleteAsync(index); } } }