mirror of
https://github.com/gogrlx/bitcask.git
synced 2026-04-02 02:58:59 -07:00
update sift to match docstring (#245)
Closes #244. Reviewed-on: https://git.mills.io/prologic/bitcask/pulls/245 Reviewed-by: James Mills <james@mills.io> Co-authored-by: Tai Groot <tai@taigrr.com> Co-committed-by: Tai Groot <tai@taigrr.com>
This commit is contained in:
12
bitcask.go
12
bitcask.go
@@ -264,7 +264,9 @@ func (b *Bitcask) Sift(f func(key []byte) (bool, error)) (err error) {
|
||||
return true
|
||||
})
|
||||
b.mu.RUnlock()
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
keysToDelete.ForEach(func(node art.Node) (cont bool) {
|
||||
@@ -343,6 +345,10 @@ func (b *Bitcask) SiftScan(prefix []byte, f func(key []byte) (bool, error)) (err
|
||||
})
|
||||
b.mu.RUnlock()
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
keysToDelete.ForEach(func(node art.Node) (cont bool) {
|
||||
@@ -422,6 +428,10 @@ func (b *Bitcask) SiftRange(start, end []byte, f func(key []byte) (bool, error))
|
||||
})
|
||||
b.mu.RUnlock()
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user