changed serialization logic to json strings, added batch compaction

This commit is contained in:
imw
2018-12-20 12:21:11 +01:00
parent 6cce8cb242
commit b4b687eeda
4 changed files with 66 additions and 20 deletions

View File

@@ -33,10 +33,26 @@ type storageInfo struct {
KeyCount int
}
func (l *LevelDbStorage) Count() int {
keycount := 0
db := l.ldb
iter := db.NewIterator(util.BytesPrefix(l.prefix), nil)
for iter.Next() {
keycount++
}
iter.Release()
if err := iter.Error(); err != nil {
panic(err)
}
return keycount
}
func (l *LevelDbStorage) Info() string {
keycount := 0
iter := l.ldb.NewIterator(nil, nil)
db := l.ldb
iter := db.NewIterator(util.BytesPrefix(l.prefix), nil)
for iter.Next() {
keycount++
}