Beispiel #1
0
        public MapIterator GetIterator(LevelDB.ReadOptions snapshot)
        {
            var         head = Helper.tagKey_MapValues.Concat(this.Value).ToArray();
            MapIterator it   = new MapIterator(db, snapshot, head);

            return(it);
        }
Beispiel #2
0
        public IValue GetItem(LevelDB.ReadOptions snapshot, byte[] key)
        {
            var _key = Helper.tagKey_MapValues.Concat(this.Value).Concat(key).ToArray();
            var data = db.Get(snapshot, _key);

            return(Helper.CreateValue(db, data));
        }
Beispiel #3
0
        public IValue GetItem(LevelDB.ReadOptions snapshot, byte[] key)
        {
            var _key = Helper.tagKey_Item.Concat(prefix).Concat(Helper.tagZero).Concat(key).ToArray();
            var data = db.Get(snapshot, _key);

            return(Helper.CreateValue(this.db, data));
        }
Beispiel #4
0
        public MapIterator(LevelDB.DB db, LevelDB.ReadOptions snapshot, byte[] head)
        {
            this.db       = db;
            this.snapshot = snapshot;
            this.head     = head;

            this.it = new LevelDB.Iterator(db, snapshot);
            it.Seek(head);
        }
Beispiel #5
0
        public UInt64 Count(LevelDB.ReadOptions ro)
        {
            byte[] key_count = Helper.tagKey_MapCount.Concat(this.Value).ToArray();
            byte[] data      = db.Get(ro, key_count);
            if (data == null || data.Length == 0)
            {
                throw new Exception("error map in Count");
            }

            return(BitConverter.ToUInt64(data, 0));
        }
Beispiel #6
0
 public WriteBatch(LevelDB.DB _db, LevelDB.ReadOptions _snapshot = null)
 {
     this.db       = _db;
     this.snapshot = _snapshot;
     if (this.snapshot == null)
     {
         this.snapshot = Helper.CreateSnapshot(db);
     }
     this.wb = new LevelDB.WriteBatch();
     cache   = new System.Collections.Concurrent.ConcurrentDictionary <System.Numerics.BigInteger, byte[]>();
 }