Exemplo n.º 1
0
        public DbSnapshot(DB db)
        {
            this.db       = db;
            this.snapshot = db.GetSnapshot();
            this.batch    = new WriteBatch();
            ReadOptions options = new ReadOptions {
                FillCache = false, Snapshot = snapshot
            };

            Blocks          = new DbCache <UInt256, TrimmedBlock>(db, options, batch, Prefixes.DATA_Block);
            Transactions    = new DbCache <UInt256, TransactionState>(db, options, batch, Prefixes.DATA_Transaction);
            Contracts       = new DbCache <UInt160, ContractState>(db, options, batch, Prefixes.ST_Contract);
            Storages        = new DbCache <StorageKey, StorageItem>(db, options, batch, Prefixes.ST_Storage);
            HeaderHashList  = new DbCache <UInt32Wrapper, HeaderHashList>(db, options, batch, Prefixes.IX_HeaderHashList);
            BlockHashIndex  = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentBlock);
            HeaderHashIndex = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentHeader);
        }
Exemplo n.º 2
0
        public DbSnapshot(DB db)
        {
            this.db       = db;
            this.snapshot = db.GetSnapshot();
            this.batch    = new WriteBatch();
            ReadOptions options = new ReadOptions {
                FillCache = false, Snapshot = snapshot
            };

            Blocks          = new DbCache <UInt256, BlockState>(db, options, batch, Prefixes.DATA_Block);
            Transactions    = new DbCache <UInt256, TransactionState>(db, options, batch, Prefixes.DATA_Transaction);
            Accounts        = new DbCache <UInt160, AccountState>(db, options, batch, Prefixes.ST_Account);
            UnspentCoins    = new DbCache <UInt256, UnspentCoinState>(db, options, batch, Prefixes.ST_Coin);
            Validators      = new DbCache <ECPoint, ValidatorState>(db, options, batch, Prefixes.ST_Validator);
            Assets          = new DbCache <UInt256, AssetState>(db, options, batch, Prefixes.ST_Asset);
            Contracts       = new DbCache <UInt160, ContractState>(db, options, batch, Prefixes.ST_Contract);
            Storages        = new DbCache <StorageKey, StorageItem>(db, options, batch, Prefixes.ST_Storage);
            HeaderHashList  = new DbCache <UInt32Wrapper, HeaderHashList>(db, options, batch, Prefixes.IX_HeaderHashList);
            ValidatorsCount = new DbMetaDataCache <ValidatorsCountState>(db, options, batch, Prefixes.IX_ValidatorsCount);
            BlockHashIndex  = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentBlock);
            HeaderHashIndex = new DbMetaDataCache <HashIndexState>(db, options, batch, Prefixes.IX_CurrentHeader);
        }