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); SpentCoins = new DbCache <UInt256, SpentCoinState>(db, options, batch, Prefixes.ST_SpentCoin); 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 DbCacheWithTrie <StorageKey, StorageItem>(db, options, batch, Prefixes.ST_Storage); StateRoots = new DbCache <UInt32Wrapper, StateRootState>(db, options, batch, Prefixes.ST_StateRoot); 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); StateRootHashIndex = new DbMetaDataCache <RootHashIndex>(db, options, batch, Prefixes.IX_CurrentStateRoot); }
public Snapshot(DB db) { this.db = db; this.snapshot = db.GetSnapshot(); this.options = new ReadOptions { FillCache = false, Snapshot = snapshot }; this.batch = new WriteBatch(); }
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); }
private void ResetBatch() { _writeBatch = new WriteBatch(); _levelDbSnapshot?.Dispose(); _levelDbSnapshot = _db.GetSnapshot(); ReadOptions dbOptions = new ReadOptions { FillCache = false, Snapshot = _levelDbSnapshot }; _balances = new DbCache <Nep5BalanceKey, Nep5Balance>(_db, dbOptions, _writeBatch, Nep5BalancePrefix); if (_shouldTrackHistory) { _transfersSent = new DbCache <Nep5TransferKey, Nep5Transfer>(_db, dbOptions, _writeBatch, Nep5TransferSentPrefix); _transfersReceived = new DbCache <Nep5TransferKey, Nep5Transfer>(_db, dbOptions, _writeBatch, Nep5TransferReceivedPrefix); } }