Commit 08d1b294 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 719088f6
...@@ -425,6 +425,7 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { // ...@@ -425,6 +425,7 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { //
} }
// XXX place // XXX place
// XXX doc
func (tidx trackIndex) AddPath(path []Node) { // XXX Tree|Bucket; path[0] = root func (tidx trackIndex) AddPath(path []Node) { // XXX Tree|Bucket; path[0] = root
l := len(path) l := len(path)
if l == 0 { if l == 0 {
...@@ -599,6 +600,16 @@ type nodeInRange struct { ...@@ -599,6 +600,16 @@ type nodeInRange struct {
done bool // whether this node was already taken into account while computing diff done bool // whether this node was already taken into account while computing diff
} }
// XXX place, doc
func (n *nodeInRange) NodePath() []Node {
path := []Node{}
for n != nil {
path = append([]Node{n.node}, path...)
n = n.parent
}
return path
}
// rangeSplit represents set of nodes covering a range. // rangeSplit represents set of nodes covering a range.
// nodes come with key↑ and no intersection in between their [lo,hi) // nodes come with key↑ and no intersection in between their [lo,hi)
type rangeSplit []*nodeInRange // key↑ type rangeSplit []*nodeInRange // key↑
...@@ -664,6 +675,7 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) { ...@@ -664,6 +675,7 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
} }
children = append(children, &nodeInRange{ children = append(children, &nodeInRange{
parent: rnode,
lo: lo, lo: lo,
hi_: hi_, hi_: hi_,
node: treev[i].Child(), node: treev[i].Child(),
...@@ -900,8 +912,8 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h ...@@ -900,8 +912,8 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
// initial split ranges for A and B // initial split ranges for A and B
// XXX maybe walk till a from root to get more precise initial range? // XXX maybe walk till a from root to get more precise initial range?
atop := &nodeInRange{lo: KeyMin, hi_: KeyMax, node: A} // [-∞, ∞) atop := &nodeInRange{lo: KeyMin, hi_: KeyMax, node: A} // [-∞, ∞) XXX parent?
btop := &nodeInRange{lo: KeyMin, hi_: KeyMax, node: B} // [-∞, ∞) btop := &nodeInRange{lo: KeyMin, hi_: KeyMax, node: B} // [-∞, ∞) XXX parent?
Av := rangeSplit{atop} // nodes expanded from A Av := rangeSplit{atop} // nodes expanded from A
Bv := rangeSplit{btop} // nodes expanded from B Bv := rangeSplit{btop} // nodes expanded from B
......
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