Skip to content

Commit

Permalink
update to new forestdb iterator api
Browse files Browse the repository at this point in the history
  • Loading branch information
mschoch committed Dec 27, 2014
1 parent 59b014d commit 38bdcbe
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions index/store/forestdb/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,37 @@ func newIteratorWithSnapshot(store *Store, snapshot *forestdb.KVStore) *Iterator
}

func (i *Iterator) SeekFirst() {
i.iterator.Seek([]byte{})
i.Next()
err := i.iterator.SeekMin()
if err != nil {
i.valid = false
return
}
i.curr, err = i.iterator.Get()
if err != nil {
i.valid = false
}
}

func (i *Iterator) Seek(key []byte) {
i.iterator.Seek(key)
i.Next()
err := i.iterator.Seek(key, forestdb.FDB_ITR_SEEK_HIGHER)
if err != nil {
i.valid = false
return
}
i.curr, err = i.iterator.Get()
if err != nil {
i.valid = false
return
}
}

func (i *Iterator) Next() {
var err error
i.curr, err = i.iterator.Next()
err := i.iterator.Next()
if err != nil {
i.valid = false
return
}
i.curr, err = i.iterator.Get()
if err != nil {
i.valid = false
}
Expand Down

0 comments on commit 38bdcbe

Please sign in to comment.