Example #1
0
        public Task IndexOrderedBalanceAsync(Transaction tx)
        {
            var table    = Configuration.GetBalanceTable();
            var entities = OrderedBalanceChange.ExtractScriptBalances(tx).Select(t => t.ToEntity(ConsensusFactory)).AsEnumerable();

            return(IndexAsync(entities, table));
        }
Example #2
0
        public void IndexOrderedBalance(Transaction tx)
        {
            var table    = Configuration.GetBalanceTable();
            var entities = OrderedBalanceChange.ExtractScriptBalances(tx).Select(t => t.ToEntity(ConsensusFactory)).AsEnumerable();

            Index(entities, table);
        }
Example #3
0
 public void IndexOrderedBalances(ChainBase chain)
 {
     IndexBalances(chain, "balances", (txid, tx, blockid, header, height) =>
     {
         return(OrderedBalanceChange.ExtractScriptBalances(txid, tx, blockid, header, height));
     });
 }
Example #4
0
        public void IndexOrderedBalance(Transaction tx)
        {
            var table = Configuration.GetBalanceTable();

            foreach (var group in OrderedBalanceChange.ExtractScriptBalances(tx).GroupBy(c => c.BalanceId, c => c.ToEntity()))
            {
                Index(group, table);
            }
        }
Example #5
0
        public void IndexOrderedBalance(int height, Block block)
        {
            var table   = Configuration.GetBalanceTable();
            var blockId = block == null ? null : block.GetHash();
            var header  = block == null ? null : block.Header;

            var entities =
                block
                .Transactions
                .SelectMany(t => OrderedBalanceChange.ExtractScriptBalances(t.GetHash(), t, blockId, header, height))
                .Select(_ => _.ToEntity(ConsensusFactory))
                .AsEnumerable();

            Index(entities, table);
        }
Example #6
0
        public void IndexOrderedBalance(int height, Block block)
        {
            var table   = Configuration.GetBalanceTable();
            var blockId = block.GetHash();

            foreach (var group in
                     block
                     .Transactions
                     .SelectMany(t => OrderedBalanceChange.ExtractScriptBalances(t.GetHash(), t, blockId, block.Header, height))
                     .Select(_ => _.ToEntity())
                     .GroupBy(c => c.PartitionKey)
                     )
            {
                foreach (var batch in group.Partition(100))
                {
                    Index(batch, table);
                }
            }
        }