Commit 2b697d13 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 57fc1eb2
......@@ -130,7 +130,7 @@ type ΔBtail struct {
// ΔB represents a change in BTrees space.
type ΔB struct {
Rev zodb.Tid
ByRoot map[zodb.Oid]map[Key]Value // {} root -> {}(key, value)
ByRoot map[zodb.Oid]map[Key]ΔValue // {} root -> {}(key, δvalue)
}
/*
......@@ -291,7 +291,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
}
fmt.Println("δZByRoot:", δZByRoot)
δB := ΔB{Rev: δZ.Tid, ByRoot: make(map[zodb.Oid]map[Key]Value)}
δB := ΔB{Rev: δZ.Tid, ByRoot: make(map[zodb.Oid]map[Key]ΔValue)}
// skip opening DB connections if there is no change to any tree node
if len(δZByRoot) == 0 {
......@@ -347,7 +347,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
//
// XXX only for tracked
// δZT is δZ/T - subset of δZ(old..new) that touches tracked nodes of T.
func treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNew *zodb.Connection) (δT map[Key]Value, err error) {
func treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNew *zodb.Connection) (δT map[Key]ΔValue, err error) {
defer xerr.Contextf(&err, "treediff %s..%s %s", zconnOld.At(), zconnNew.At(), root)
// XXX zconnX -> a, b ?
......@@ -357,7 +357,7 @@ func treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNe
// e.g. t₀->t₁->b₂ δZ={t₀ b₂} -> δZC=δZ+{t₁}
δZTC := δZT // FIXME stub
δT = map[Key]Value{}
δT = map[Key]ΔValue{}
for top := range δZT { // XXX -> sorted?
a, err1 := zgetNode(ctx, zconnOld, top)
......@@ -376,8 +376,8 @@ func treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNe
// XXX no - not needed here - keys cannot migrate in between two disconnected subtrees
// DEL k -> Tkextra += k
// +k -> Tkextra -= k
for k,v := range δtop {
δT[k] = v
for k,δv := range δtop {
δT[k] = δv
}
}
......@@ -392,7 +392,7 @@ func treediff(ctx context.Context, root zodb.Oid, δZT SetOid, zconnOld, zconnNe
// δZTC is connected set of objects covering δZT (objects changed in this tree in old..new).
//
// a/b can be nil; a=nil means addition, b=nil means deletion.
func diffX(ctx context.Context, a, b Node, δZTC SetOid) (δ map[Key]Value, err error) {
func diffX(ctx context.Context, a, b Node, δZTC SetOid) (δ map[Key]ΔValue, err error) {
if a==nil && b==nil {
panic("BUG: both a & b == nil")
}
......@@ -460,7 +460,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid) (δ map[Key]ΔValue, e
bv = b.Entryv() // key↑
}
δ = map[Key]Value{}
δ = map[Key]ΔValue{}
// [i].Key ≤ [i].Child.*.Key < [i+1].Key i ∈ [0, len([]))
//
......
......@@ -596,7 +596,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
// δT <- δB
δToid := δB.ByRoot[treeRoot] // {} k -> oid
δToid := δB.ByRoot[treeRoot] // {} k -> δoid
δT = XGetKV(db, at2, δToid) // {} k -> ZBlk(oid).data
// δT must be subset of d12.
......
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