Commit 91340c7a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 7c87537a
// DO NOT EDIT - AUTOGENERATED (by gen-fsbtree from github.com/cznic/b bcff30a) // DO NOT EDIT - AUTOGENERATED (by gen-fsbtree from github.com/cznic/b aaaa43c)
// KEY=zodb.Oid VALUE=int64 // KEY=zodb.Oid VALUE=int64
// ---- 8< ---- // ---- 8< ----
...@@ -830,13 +830,7 @@ func (e *Enumerator) Next() (k zodb.Oid, v int64, err error) { ...@@ -830,13 +830,7 @@ func (e *Enumerator) Next() (k zodb.Oid, v int64, err error) {
} }
if e.ver != e.t.ver { if e.ver != e.t.ver {
f, hit := e.t.Seek(e.k) f, _ := e.t.Seek(e.k)
if !e.hit && hit {
if err = f.next(); err != nil {
return
}
}
*e = *f *e = *f
f.Close() f.Close()
} }
...@@ -853,7 +847,7 @@ func (e *Enumerator) Next() (k zodb.Oid, v int64, err error) { ...@@ -853,7 +847,7 @@ func (e *Enumerator) Next() (k zodb.Oid, v int64, err error) {
i := e.q.d[e.i] i := e.q.d[e.i]
k, v = i.k, i.v k, v = i.k, i.v
e.k, e.hit = k, false e.k, e.hit = k, true
e.next() e.next()
return return
} }
...@@ -884,13 +878,7 @@ func (e *Enumerator) Prev() (k zodb.Oid, v int64, err error) { ...@@ -884,13 +878,7 @@ func (e *Enumerator) Prev() (k zodb.Oid, v int64, err error) {
} }
if e.ver != e.t.ver { if e.ver != e.t.ver {
f, hit := e.t.Seek(e.k) f, _ := e.t.Seek(e.k)
if !e.hit && hit {
if err = f.prev(); err != nil {
return
}
}
*e = *f *e = *f
f.Close() f.Close()
} }
...@@ -899,15 +887,22 @@ func (e *Enumerator) Prev() (k zodb.Oid, v int64, err error) { ...@@ -899,15 +887,22 @@ func (e *Enumerator) Prev() (k zodb.Oid, v int64, err error) {
return return
} }
if !e.hit {
// move to previous because Seek overshoots if there's no hit
if err = e.prev(); err != nil {
return
}
}
if e.i >= e.q.c { if e.i >= e.q.c {
if err = e.next(); err != nil { if err = e.prev(); err != nil {
return return
} }
} }
i := e.q.d[e.i] i := e.q.d[e.i]
k, v = i.k, i.v k, v = i.k, i.v
e.k, e.hit = k, false e.k, e.hit = k, true
e.prev() e.prev()
return return
} }
......
// DO NOT EDIT - AUTOGENERATED (by gen-fsbtree from github.com/cznic/b bcff30a) // DO NOT EDIT - AUTOGENERATED (by gen-fsbtree from github.com/cznic/b aaaa43c)
// ---- 8< ---- // ---- 8< ----
package fsb package fsb
import ( import (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment