Exemplo n.º 1
0
        public QueryBlock GetBlock(long blockIndex, bool getTransactions = true)
        {
            Storage.Types.SyncBlockInfo block = storage.BlockGetByIndex(blockIndex);

            if (block == null)
            {
                return(new QueryBlock());
            }

            var queryBlock = new QueryBlock
            {
                Symbol            = chainConfiguration.Symbol,
                BlockHash         = block.BlockHash,
                BlockIndex        = block.BlockIndex,
                BlockSize         = block.BlockSize,
                BlockTime         = block.BlockTime,
                NextBlockHash     = block.NextBlockHash,
                PreviousBlockHash = block.PreviousBlockHash,
                Synced            = block.SyncComplete,
                TransactionCount  = block.TransactionCount,
                Bits              = block.Bits,
                Confirmations     = block.Confirmations,
                Merkleroot        = block.Merkleroot,
                Nonce             = block.Nonce,
                PosBlockSignature = block.PosBlockSignature,
                PosBlockTrust     = block.PosBlockTrust,
                PosChainTrust     = block.PosChainTrust,
                PosFlags          = block.PosFlags,
                PosHashProof      = block.PosHashProof,
                PosModifierv2     = block.PosModifierv2,
                Version           = block.Version,
                Transactions      = Enumerable.Empty <string>()
            };

            if (getTransactions)
            {
                IEnumerable <Storage.Types.SyncTransactionInfo> transactions = storage.BlockTransactionGetByBlockIndex(block.BlockIndex);
                queryBlock.Transactions = transactions.Select(s => s.TransactionHash);
            }

            return(queryBlock);
        }
Exemplo n.º 2
0
        public QueryBlock GetLastBlock(bool getTransactions = true)
        {
            var block = this.storage.BlockGetCompleteBlockCount(1).FirstOrDefault();

            if (block == null)
            {
                return(new QueryBlock());
            }

            var queryBlock = new QueryBlock
            {
                CoinTag           = this.configuration.CoinTag,
                BlockHash         = block.BlockHash,
                BlockIndex        = block.BlockIndex,
                BlockSize         = block.BlockSize,
                BlockTime         = block.BlockTime,
                NextBlockHash     = block.NextBlockHash,
                PreviousBlockHash = block.PreviousBlockHash,
                Synced            = block.SyncComplete,
                TransactionCount  = block.TransactionCount,
                Bits              = block.Bits,
                Confirmations     = block.Confirmations,
                Merkleroot        = block.Merkleroot,
                Nonce             = block.Nonce,
                PosBlockSignature = block.PosBlockSignature,
                PosBlockTrust     = block.PosBlockTrust,
                PosChainTrust     = block.PosChainTrust,
                PosFlags          = block.PosFlags,
                PosHashProof      = block.PosHashProof,
                PosModifierv2     = block.PosModifierv2,
                Version           = block.Version,
                Transactions      = Enumerable.Empty <string>()
            };

            if (getTransactions)
            {
                var transactions = this.storage.BlockTransactionGetByBlockIndex(block.BlockIndex);
                queryBlock.Transactions = transactions.Select(s => s.TransactionHash);
            }

            return(queryBlock);
        }
Exemplo n.º 3
0
        public QueryBlocks GetBlocks(long blockIndex, int count)
        {
            var blocks = new List <QueryBlock>();

            if (blockIndex == -1)
            {
                QueryBlock lastBlock = this.GetLastBlock(false);
                blocks.Add(lastBlock);
                blockIndex = lastBlock.BlockIndex - 1;
                count--;
            }

            for (long i = 0; i < count; i++)
            {
                blocks.Add(this.GetBlock((int)blockIndex - i, false));
            }

            return(new QueryBlocks
            {
                Blocks = blocks
            });
        }
Exemplo n.º 4
0
 public Where(QueryBlock block, Expression expr, Location loc)
     : base(block, expr, loc)
 {
 }
Exemplo n.º 5
0
 public GroupJoin(QueryBlock block, RangeVariable lt, Expression inner,
                  QueryBlock outerSelector, QueryBlock innerSelector, RangeVariable into, Location loc)
     : base(block, lt, inner, outerSelector, innerSelector, loc)
 {
     this.into = into;
 }
Exemplo n.º 6
0
        //get the main queryable
        //for each level we have to produce a single selector expression
        //if the field is singular join it
        //if the field is a collection we need to apply a selector to the entity collection with the join condition and any additional conditions

        private Expression MakeQueryableExpression(IModel targetModel, Expression parentItem, QueryBlock block)
        {
            return(null);
        }
Exemplo n.º 7
0
 public override ScalarValue VisitQueryBlock(QueryBlock node)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 8
0
 public OrderByDescending(QueryBlock block, Expression expr)
     : base(block, expr, expr.Location)
 {
 }
Exemplo n.º 9
0
 public ThenByDescending(QueryBlock block, Expression expr)
     : base(block, expr)
 {
 }
Exemplo n.º 10
0
 public Join(QueryBlock block, RangeVariable lt, Expression inner, QueryBlock outerSelector, QueryBlock innerSelector, Location loc)
     : base(block, lt, inner, loc)
 {
     this.outer_selector = outerSelector;
     this.inner_selector = innerSelector;
 }
Exemplo n.º 11
0
 public SelectMany(QueryBlock block, RangeVariable identifier, Expression expr, Location loc)
     : base(block, identifier, expr, loc)
 {
 }
Exemplo n.º 12
0
 protected ARangeVariableQueryClause(QueryBlock block, RangeVariable identifier, Expression expr, Location loc)
     : base(block, expr, loc)
 {
     this.identifier = identifier;
 }
Exemplo n.º 13
0
 public FieldBlock(QueryBlock query, Expression expression)
 {
     _query = query;
     Inspect(expression);
 }
Exemplo n.º 14
0
        public ActionResult PageList(QueryBlock query)
        {
            var list = BlockManager.GetInstance().GetPageList(query);

            return(Json(new { data = list.DataList, pagehtml = list.PagerHtml(), index = list.Index }));
        }
Exemplo n.º 15
0
 public Select(QueryBlock block, Expression expr, Location loc)
     : base(block, expr, loc)
 {
 }