public long GetKeyValueCount() { if (_prefixKeyCount >= 0) { return(_prefixKeyCount); } if (_prefix.Length == 0) { _prefixKeyCount = ArtRoot.GetCount(); return(_prefixKeyCount); } CalcPrefixKeyStart(); if (_prefixKeyStart < 0) { _prefixKeyCount = 0; return(0); } if (_cursor2 == null) { _cursor2 = ArtRoot.CreateCursor(); } _cursor2.FindLast(_prefix); _prefixKeyCount = _cursor2.CalcIndex() - _prefixKeyStart + 1; return(_prefixKeyCount); }
public void CanInsertFirstData(byte[] key) { Assert.Equal(0, _root.GetCount()); var val = GetSampleValue(); Assert.True(_cursor.Upsert(key, val)); Assert.Equal(1, _root.GetCount()); Assert.Equal(key.Length, _cursor.GetKeyLength()); Assert.Equal(key, _cursor.FillByKey(new byte[key.Length]).ToArray()); Assert.Equal(val.Length, _cursor.GetValueLength()); Assert.Equal(val.ToArray(), _cursor.GetValue().ToArray()); }
public string CalcStats() { return("KeyValueCount:" + _lastCommited.GetCount() + Environment.NewLine); }