Commit 441e3666 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 599a72f3
......@@ -1370,7 +1370,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// pin all tracked file blocks that were changed (at, head] range
for _, δfile := range bfdir.δFtail.SliceByFileRev(f, at, head.zconn.At()) {
for _, blk := range δfile.Change {
for blk := range δfile.Change {
_, already := toPin[blk]
if already {
continue
......
......@@ -335,6 +335,12 @@ func (δΒtail *ΔBtail) Get(ctx context.Context, root *Tree, key Key, at zodb.T
return
}
// XXX SliceByRev
// XXX
func (δBtail *ΔBtail) SliceByRootRev(root *Tree, lo, hi zodb.Tid) /*readonly*/[]ΔTree {
panic("TODO")
}
// δ(BTree) notes
// ==============
......
......@@ -72,6 +72,12 @@ type ΔF struct {
Change map[*BigFile]SetI64 // file -> δfile (= {}#blk)
}
// Δfile represents a change to one file.
type Δfile struct {
Rev zodb.Tid
Change SetI64 // changed blocks
}
// NewΔFtail creates new ΔFtail object.
//
// Initial tracked set is empty.
......@@ -149,6 +155,24 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
panic("TODO")
}
// XXX SliceByRev
// XXX SliceByFileRev
func (δFtail *ΔFtail) SliceByFileRev(f *BigFile, lo, hi zodb.Tid) /*readonly*/[]Δfile {
tail := δFtail.Tail()
head := δFtail.Head()
if !(tail <= lo && lo <= hi && hi <= head) {
panicf("δFtail.SliceByFileRev: invalid query: (%s, %s]; (tail, head] = (%s, %s]", lo, hi, tail, head)
}
// XXX activate zfile?
vδT := δFtail.δBtail.SliceByRootRev(f.zfile.blktab, lo, hi)
_ = vδT
panic("TODO")
}
// LastBlkRev returns last revision that changed file[blk] as of @at database state.
//
// if exact=False - what is returned is only an upper bound for last block revision.
......@@ -164,6 +188,7 @@ func (f *BigFile) LastBlkRev(ctx context.Context, blk int64, at zodb.Tid) (_ zod
δFtail := f.head.bfdir.δFtail
// XXX tabRev -> treeRev ?
// XXX activate zfile?
zblkOid, ok, tabRev, tabRevExact, err := δFtail.δBtail.Get(ctx, f.zfile.blktab, blk, at)
if err != nil {
panic(err)
......@@ -186,6 +211,3 @@ func (f *BigFile) LastBlkRev(ctx context.Context, blk int64, at zodb.Tid) (_ zod
return tabRev, tabRevExact
}
}
// XXX SliceByRev
// XXX SliceByFileRev
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