Ejemplo n.º 1
0
        public Snapshot(RocksDb db)
        {
            this.db       = db;
            this.snapshot = db.CreateSnapshot();
            this.batch    = new WriteBatch();

            options = new ReadOptions();
            options.SetFillCache(false);
            options.SetSnapshot(snapshot);
        }
Ejemplo n.º 2
0
        public Snapshot(Store store, RocksDb db)
        {
            this.store    = store;
            this.db       = db;
            this.snapshot = db.CreateSnapshot();

            options = new ReadOptions();
            options.SetFillCache(false);
            options.SetSnapshot(snapshot);
        }
Ejemplo n.º 3
0
 public Snapshot(RocksDb db, ColumnFamilyHandle columnFamily)
 {
     this.db           = db;
     this.columnFamily = columnFamily;
     snapshot          = db.CreateSnapshot();
     readOptions       = new ReadOptions()
                         .SetSnapshot(snapshot)
                         .SetFillCache(false);
     writeBatch = new WriteBatch();
 }
            public Snapshot(RocksDb db)
            {
                this.db = db;
                snapshot = db.CreateSnapshot();
                readOptions = new ReadOptions().SetSnapshot(snapshot).SetFillCache(false);
                writeBatch = new WriteBatch();

                Blocks = new DataCache<UInt256, BlockState>(db, BLOCK_FAMILY, readOptions, writeBatch);
                Transactions = new DataCache<UInt256, TransactionState>(db, TX_FAMILY, readOptions, writeBatch);
                Accounts = new DataCache<UInt160, AccountState>(db, ACCOUNT_FAMILY, readOptions, writeBatch);
                UnspentCoins = new DataCache<UInt256, UnspentCoinState>(db, UNSPENT_COIN_FAMILY, readOptions, writeBatch);
                SpentCoins = new DataCache<UInt256, SpentCoinState>(db, SPENT_COIN_FAMILY, readOptions, writeBatch);
                Validators = new DataCache<ECPoint, ValidatorState>(db, VALIDATOR_FAMILY, readOptions, writeBatch);
                Assets = new DataCache<UInt256, AssetState>(db, ASSET_FAMILY, readOptions, writeBatch);
                Contracts = new DataCache<UInt160, ContractState>(db, CONTRACT_FAMILY, readOptions, writeBatch);
                Storages = new DataCache<StorageKey, StorageItem>(db, STORAGE_FAMILY, readOptions, writeBatch);
                HeaderHashList = new DataCache<UInt32Wrapper, HeaderHashList>(db, HEADER_HASH_LIST_FAMILY, readOptions, writeBatch);
                ValidatorsCount = new MetaDataCache<ValidatorsCountState>(db, VALIDATORS_COUNT_KEY, readOptions, writeBatch);
                BlockHashIndex = new MetaDataCache<HashIndexState>(db, CURRENT_BLOCK_KEY, readOptions, writeBatch);
                HeaderHashIndex = new MetaDataCache<HashIndexState>(db, CURRENT_HEADER_KEY, readOptions, writeBatch);
            }