Commit e215d7e6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 011fafc5
...@@ -40,6 +40,7 @@ type Tree = btree.LOBTree ...@@ -40,6 +40,7 @@ type Tree = btree.LOBTree
type Bucket = btree.LOBucket type Bucket = btree.LOBucket
type Node = btree.LONode type Node = btree.LONode
type TreeEntry = btree.LOEntry
type BucketEntry = btree.LOBucketEntry type BucketEntry = btree.LOBucketEntry
type Key = int64 type Key = int64
...@@ -417,20 +418,25 @@ func diffX(ctx context.Context, a, b Node, δZTC SetOid) (δ map[Key]Value, err ...@@ -417,20 +418,25 @@ func diffX(ctx context.Context, a, b Node, δZTC SetOid) (δ map[Key]Value, err
func diffT(ctx context.Context, a, b *Tree, δZTC SetOid) (δ map[Key]Value, err error) { func diffT(ctx context.Context, a, b *Tree, δZTC SetOid) (δ map[Key]Value, err error) {
fmt.Printf(" T %s %s\n", xidOf(a), xidOf(b)) fmt.Printf(" T %s %s\n", xidOf(a), xidOf(b))
defer xerr.Contextf(&err, "diffT %s %s", xidOf(a), xidOf(b)) defer xerr.Contextf(&err, "diffT %s %s", xidOf(a), xidOf(b))
if a.POid() != b.POid() {
if (a != nil && b != nil) && (a.POid() != b.POid()) {
panic("different trees") panic("different trees")
} }
// XXX a/b = nil - means del/add -> handle var av []TreeEntry
var bv []TreeEntry
err = a.PActivate(ctx); if err != nil { return nil, err } if a != nil {
defer a.PDeactivate() err = a.PActivate(ctx); if err != nil { return nil, err }
err = b.PActivate(ctx); if err != nil { return nil, err } defer a.PDeactivate()
defer b.PDeactivate() av = a.Entryv() // key↑
}
if b != nil {
err = b.PActivate(ctx); if err != nil { return nil, err }
defer b.PDeactivate()
bv = b.Entryv() // key↑
}
av := a.Entryv() // key↑ δ = map[Key]Value{}
bv := b.Entryv() // key↑
δ = map[Key]Value{}
// [i].Key ≤ [i].Child.*.Key < [i+1].Key i ∈ [0, len([])) // [i].Key ≤ [i].Child.*.Key < [i+1].Key i ∈ [0, len([]))
// //
...@@ -494,11 +500,10 @@ func diffB(ctx context.Context, a, b *Bucket) (δ map[Key]Value, err error) { ...@@ -494,11 +500,10 @@ func diffB(ctx context.Context, a, b *Bucket) (δ map[Key]Value, err error) {
fmt.Printf(" B %s %s\n", xidOf(a), xidOf(b)) fmt.Printf(" B %s %s\n", xidOf(a), xidOf(b))
defer xerr.Contextf(&err, "diffB %s %s", xidOf(a), xidOf(b)) defer xerr.Contextf(&err, "diffB %s %s", xidOf(a), xidOf(b))
// XXX oid can be InvalidOid for T/B... (i.e. B is part of T and is not yet committed separately) // XXX oid can be InvalidOid for T/B... (i.e. B is part of T and is not yet committed separately)
if a.POid() != b.POid() { if (a != nil && b != nil) && (a.POid() != b.POid()) {
panic("different buckets") panic("different buckets")
} }
// XXX a/b = nil - means del/add -> handle
var av []BucketEntry var av []BucketEntry
var bv []BucketEntry var bv []BucketEntry
......
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