Beispiel #1
0
        public DbSnapshot(DB db, long height, bool bUndo)
        {
            Monitor.Enter(db);

            this.db       = db;
            this.snapshot = db.CreateSnapshot();
            this.batch    = new WriteBatch();
            this.options  = new ReadOptions {
                FillCache = false, Snapshot = snapshot
            };

            if (bUndo)
            {
                Undos        = new DbUndo();
                Undos.height = height;
                long.TryParse(db.Get("UndoHeight"), out long UndoHeight);
                if (UndoHeight + 1 != Undos.height)
                {
                    throw new InvalidOperationException($"{UndoHeight} heightTotal+1 != Undos.height {Undos.height}");
                }
            }

            Snap            = new DbCache <string>(db, options, batch, Undos, "Snap");
            Blocks          = new DbCache <Block>(db, options, batch, null, "Blocks");
            Heights         = new DbCache <List <string> >(db, options, batch, null, "Heights");
            Transfers       = new DbCache <BlockSub>(db, options, batch, Undos, "Trans");
            Accounts        = new DbCache <Account>(db, options, batch, Undos, "Accounts");
            Contracts       = new DbCache <LuaVMScript>(db, options, batch, Undos, "Contracts");
            Storages        = new DbCache <LuaVMContext>(db, options, batch, Undos, "Storages");
            BlockChains     = new DbCache <BlockChain>(db, options, batch, Undos, "BlockChain");
            StoragesAccount = new DbCache <string>(db, options, batch, Undos, "StgAcc");
            ABC             = new DbCache <List <string> >(db, options, batch, Undos, "ABC");
            List            = new DbList <string>(db, options, batch, Undos, "List");
        }
Beispiel #2
0
 public LuaVMDBList(DbList <TValue> _dbList)
 {
     dbList = _dbList;
 }