mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-02 22:21:44 +00:00
db: Simplify exists check, fix IsKeyInDomain signature, Iterator Close
+ *FSDB.HasKey now uses common.FileExists to test for file existence + IsKeyInDomain takes key as a []byte slice instead of as a string to avoid extraneous []byte<-->string conversions for start and end + Iterator.Close() instead of Iterator.Release() + withDB helper to encapsulate DB creation, deferred cleanups so that for loops can use opened DBs and discard them ASAP Addressing accepted changes from review with @jaekwon
This commit is contained in:
@ -68,7 +68,7 @@ func EndingKey() []byte {
|
||||
Usage:
|
||||
|
||||
var itr Iterator = ...
|
||||
defer itr.Release()
|
||||
defer itr.Close()
|
||||
|
||||
for ; itr.Valid(); itr.Next() {
|
||||
k, v := itr.Key(); itr.Value()
|
||||
@ -108,7 +108,7 @@ type Iterator interface {
|
||||
Value() []byte
|
||||
|
||||
// Release deallocates the given Iterator.
|
||||
Release()
|
||||
Close()
|
||||
}
|
||||
|
||||
// For testing convenience.
|
||||
|
Reference in New Issue
Block a user