mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-17 15:48:17 +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)
|
ro.SetFillCache(false)
|
||||||
|
|
||||||
it := ldbs.backend.db.NewIterator(ro)
|
it := ldbs.backend.db.NewIterator(ro)
|
||||||
|
it.SeekToFirst()
|
||||||
for ; it.Valid(); it.Next() {
|
for ; it.Valid(); it.Next() {
|
||||||
n++
|
n++
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = it.GetError(); err != nil {
|
if err = it.GetError(); err != nil {
|
||||||
ro.Close()
|
|
||||||
it.Close()
|
it.Close()
|
||||||
|
ro.Close()
|
||||||
ldbs.backend.mutex.RUnlock()
|
ldbs.backend.mutex.RUnlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -178,6 +179,7 @@ func (ldbs *LevelDBSession) AllKeys(hash []byte) (keys chan []byte, n int, err e
|
|||||||
defer close(keys)
|
defer close(keys)
|
||||||
it := ldbs.backend.db.NewIterator(ro)
|
it := ldbs.backend.db.NewIterator(ro)
|
||||||
defer it.Close()
|
defer it.Close()
|
||||||
|
it.SeekToFirst()
|
||||||
for ; it.Valid(); it.Next() {
|
for ; it.Valid(); it.Next() {
|
||||||
keys <- it.Key()
|
keys <- it.Key()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user