Commit f9c29c14 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent de844b01
...@@ -25,6 +25,7 @@ package zdata ...@@ -25,6 +25,7 @@ package zdata
import ( import (
"context" "context"
"fmt" "fmt"
"sort"
"lab.nexedi.com/kirr/go123/xerr" "lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/neo/go/transaction" "lab.nexedi.com/kirr/neo/go/transaction"
...@@ -539,7 +540,34 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado ...@@ -539,7 +540,34 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
func (δFtail *ΔFtail) LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64, at zodb.Tid) (_ zodb.Tid, exact bool) { func (δFtail *ΔFtail) LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64, at zodb.Tid) (_ zodb.Tid, exact bool) {
//defer xerr.Contextf(&err, "") // XXX text //defer xerr.Contextf(&err, "") // XXX text
//δftail := δFtail.byFile[zf.POid()] // XXX locking
// XXX rebuild
δftail := δFtail.byFile[zf.POid()]
// find epoch that covers at
vδE := δftail.vδE
l := len(vδE)
i := sort.Search(l, func(i int) bool {
return at < vδE[i].Rev
})
// vδE[i] is next epoch
// vδE[i-1] is epoch that covers at
var root zodb.Oid
var epoch zodb.Tid
if i == l {
root = zf.blktab // XXX activate
} else {
root = vδE[i].oldRoot
}
i--
if i < 0 {
// i<0 - first epoch (no explicit start) - use δFtail.tail as lo
epoch = δFtail.Tail()
} else {
epoch = vδE[i].Rev
}
//root := δftail.root // XXX handle epochs //root := δftail.root // XXX handle epochs
err := zf.PActivate(ctx) err := zf.PActivate(ctx)
...@@ -553,7 +581,6 @@ func (δFtail *ΔFtail) LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64, ...@@ -553,7 +581,6 @@ func (δFtail *ΔFtail) LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64,
defer zf.PDeactivate() defer zf.PDeactivate()
// XXX take epochs into account // XXX take epochs into account
epoch := zodb.Tid(0) // XXX stub
// XXX tabRev -> treeRev ? // XXX tabRev -> treeRev ?
//zblkOid, ok, tabRev, tabRevExact, err := δFtail.δBtail.GetAt(ctx, root, blk, at) //zblkOid, ok, tabRev, tabRevExact, err := δFtail.δBtail.GetAt(ctx, root, blk, at)
......
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