public async Task <bool> CreateHistoryAddressIfNotExistsAsync(string address, HistoryAddressCategory category)
 {
     return(await _historyAddressesStorage.CreateIfNotExistsAsync(new HistoryAddressEntity()
     {
         PartitionKey = GetHistoryPartitionKey(address),
         RowKey = GetHistoryRowKey(category)
     }));
 }
        public async Task <bool> CreateIfNotExistsAsync(T item)
        {
            var res = await _table.CreateIfNotExistsAsync(item);

            await _cache.CreateIfNotExistsAsync(item);

            return(res);
        }
 public async Task <bool> CreateBalanceAddressIfNotExistsAsync(string address)
 {
     return(await _balanceAddressesStorage.CreateIfNotExistsAsync(new BalanceAddressEntity()
     {
         PartitionKey = GetBalancePartitionKey(address),
         RowKey = GetBalanceRowKey()
     }));
 }
예제 #4
0
        public async Task AddAsync(OperationValidation validation)
        {
            var entity = new OperationValidationEntity(validation);
            await _storage.CreateIfNotExistsAsync(entity);

            if (validation.Risk.IsResolutionRequired)
            {
                await _index.CreateIfNotExistsAsync(new AzureIndex(OperationValidationEntity.IndexPk(), entity.PartitionKey, entity));
            }
        }
        public async Task <bool> SaveConfirmedIfNotExist(string hash, string clientId)
        {
            // processed in old version (can be removed later)
            const string oldParitionKey = "T";

            if (await _tableStorage.GetDataAsync(oldParitionKey, hash) != null)
            {
                return(false);
            }

            return(await _tableStorage.CreateIfNotExistsAsync(ConfirmedTransactionRecord.Create(hash, clientId)));
        }
        public Task <bool> CreateIfNotExistsAsync(
            string address)
        {
            var(partitionKey, rowKey) = GetKeys(address);

            var entity = new BalanceEntity
            {
                PartitionKey = partitionKey,
                RowKey       = rowKey
            };

            return(_balances.CreateIfNotExistsAsync(entity));
        }
        public async Task AzureStorage_CheckParallelInsert()
        {
            var testEntity = GetTestEntity();

            Parallel.For(1, 10, i =>
            {
                _testEntityStorage.CreateIfNotExistsAsync(testEntity).Wait();
            });

            var createdEntity = await _testEntityStorage.GetDataAsync(testEntity.PartitionKey, testEntity.RowKey);

            Assert.IsNotNull(createdEntity);
        }
예제 #8
0
        public async Task <string> CreateEntityOrGetPayload(string requestId, string payload)
        {
            var entity = IdempotentEntity.Build(requestId, payload);

            var createdNow = await _tableStorage.CreateIfNotExistsAsync(entity);

            if (createdNow)
            {
                return(null);
            }
            else
            {
                entity = await _tableStorage.GetTopRecordAsync(entity.PartitionKey);

                return(entity.Payload);
            }
        }
        public Task <bool> CreateIfNotExistsAsync(T item)
        {
            var cryptoItem = Encrypt(item);

            return(_storage.CreateIfNotExistsAsync(cryptoItem));
        }
 public async Task <bool> CreateIfNotExistsAsync(TEntity item)
 {
     return(await _retryService.RetryAsync(async() => await _impl.CreateIfNotExistsAsync(item), _onModificationsRetryCount));
 }
예제 #11
0
 public async Task InsertIfNotExist(IOperationEvent operationEvent)
 {
     await _storage.CreateIfNotExistsAsync(OperationEventTableEntity.Create(operationEvent));
 }
 public Task <bool> CreateIfNotExistsAsync(TEntity item)
 => WrapAsync(() => _impl.CreateIfNotExistsAsync(item), nameof(CreateIfNotExistsAsync), item);
 public async Task <bool> TryObserveAsync(string address) =>
 await _walletStorage.CreateIfNotExistsAsync(new DepositWalletEntity(address));
        public async Task <bool> InsertIfNotExistsAsync(IBalanceChangeTransaction balanceChangeTransaction)
        {
            var entity = BalanceChangeTransactionEntity.Create(balanceChangeTransaction);

            return(await _tableStorage.CreateIfNotExistsAsync(entity));
        }