public MapIterator GetIterator(LevelDB.ReadOptions snapshot) { var head = Helper.tagKey_MapValues.Concat(this.Value).ToArray(); MapIterator it = new MapIterator(db, snapshot, head); return(it); }
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)); }
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)); }
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); }
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)); }
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[]>(); }