mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-08 03:00:26 +01:00
LevelDB: Seeked to start to get all the keys in HKEYS command.
This commit is contained in:
parent
d321d1888b
commit
d54af34288
|
@ -158,13 +158,14 @@ func (ldbs *LevelDBSession) AllKeys(hash []byte) (keys chan []byte, n int, err e
|
|||
ro.SetFillCache(false)
|
||||
|
||||
it := ldbs.backend.db.NewIterator(ro)
|
||||
it.SeekToFirst()
|
||||
for ; it.Valid(); it.Next() {
|
||||
n++
|
||||
}
|
||||
|
||||
if err = it.GetError(); err != nil {
|
||||
ro.Close()
|
||||
it.Close()
|
||||
ro.Close()
|
||||
ldbs.backend.mutex.RUnlock()
|
||||
return
|
||||
}
|
||||
|
@ -178,6 +179,7 @@ func (ldbs *LevelDBSession) AllKeys(hash []byte) (keys chan []byte, n int, err e
|
|||
defer close(keys)
|
||||
it := ldbs.backend.db.NewIterator(ro)
|
||||
defer it.Close()
|
||||
it.SeekToFirst()
|
||||
for ; it.Valid(); it.Next() {
|
||||
keys <- it.Key()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user