Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        public async Task <Guid?> GetOperationId(string hash)
        {
            var index = await _tableIndex.GetDataAsync(IndexEntity.GetPartitionKeyHash(), hash);

            if (index != null)
            {
                return(Guid.Parse(index.Value));
            }

            return(null);
        }
Beispiel #3
0
        public async Task InsertOrReplaceAsync(TxBroadcast broadcast)
        {
            var entity = broadcast.ToEntity(GetPartitionKey(), GetRowKey(broadcast.OperationId));
            await _table.InsertOrReplaceAsync(entity);

            // add index
            if (!string.IsNullOrEmpty(broadcast.Hash))
            {
                var index = new IndexEntity
                {
                    PartitionKey = IndexEntity.GetPartitionKeyHash(),
                    RowKey       = broadcast.Hash,
                    Value        = entity.RowKey
                };
                await _tableIndex.InsertOrReplaceAsync(index);
            }
        }