Commit d37f8481 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent fc8e10e8
......@@ -61,7 +61,7 @@ const debugΔBtail = false
// .Track(path) - start tracking tree nodes and keys; root=path[0], keys=path[-1].(lo,hi]
//
// .Update(δZ) -> δB - update BTree δ tail given raw ZODB changes
// .ForgetPast(revCut) - forget changes past revCut
// .ForgetPast(revCut) - forget changes revCut
// .SliceByRev(lo, hi) -> []δB - query for all trees changes with rev ∈ (lo, hi]
// .SliceByRootRev(root, lo, hi) -> []δT - query for changes of a tree with rev ∈ (lo, hi]
// .GetAt(root, key, at) - get root[key] @at assuming root[key] ∈ tracked
......@@ -92,12 +92,12 @@ type ΔBtail struct {
// taken into account, is kept in _ΔTtail.trackNew & co.
trackSet blib.PPTreeSubSet
// set of trees for which .trackNew is non-empty
// set of trees for which _ΔTtail.trackNew is non-empty
trackNewRoots setOid
// handle to make connections to access database.
// TODO allow client to optionally provide zconnOld/zconnNew on e.g. Update()
db *zodb.DB // to open connections to load new/old tree|buckets
db *zodb.DB // to open connections to load new/old tree|buckets
}
// _ΔTtail represent tail of revisional changes to one BTree.
......@@ -128,7 +128,7 @@ type ΔB struct {
// ΔTree describes changes to one BTree in one revision.
type ΔTree struct {
Rev zodb.Tid
Rev zodb.Tid
KV map[Key]ΔValue
}
......@@ -237,8 +237,6 @@ func (δBtail *ΔBtail) Track(key Key, nodePath []Node) {
// NOTE key not needed for anything besides tracing
// (tracking set will be added with all keys, covered by leaf keyrange)
// XXX assert node.PJar().At() == .Head()
path := nodePathToPath(nodePath)
if traceΔBtail {
......@@ -248,6 +246,14 @@ func (δBtail *ΔBtail) Track(key Key, nodePath []Node) {
tracefΔBtail("trackSet: %s\n", δBtail.trackSet) // XXX locking
}
head := δBtail.Head()
for _, node := range nodePath {
nodeAt := node.PJar().At()
if nodeAt != head {
panicf("node.at (@%s) != δBtail.head (@%s)", nodeAt, head)
}
}
δBtail.track(key, path)
}
......
......@@ -104,7 +104,7 @@ type setOid = set.Oid
// .Track(file, blk, path, zblk) - add file and block reached via BTree path to tracked set.
//
// .Update(δZ) -> δF - update files δ tail given raw ZODB changes
// .ForgetPast(revCut) - forget changes past revCut
// .ForgetPast(revCut) - forget changes revCut
// .SliceByRev(lo, hi) -> []δF - query for all files changes with rev ∈ (lo, hi]
// .SliceByFileRev(file, lo, hi) -> []δfile - query for changes of a file with rev ∈ (lo, hi]
// .BlkRevAt(file, #blk, at) - query for what is last revision that changed
......
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