Commit 17d96e82 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4a7e9275
...@@ -319,7 +319,8 @@ func (δBtail *ΔBtail) treediff(ctx context.Context, root zodb.Oid, δZT SetOid ...@@ -319,7 +319,8 @@ func (δBtail *ΔBtail) treediff(ctx context.Context, root zodb.Oid, δZT SetOid
defer xerr.Contextf(&err, "treediff %s..%s %s", zconnOld.At(), zconnNew.At(), root) defer xerr.Contextf(&err, "treediff %s..%s %s", zconnOld.At(), zconnNew.At(), root)
// XXX zconnX -> a, b ? // XXX zconnX -> a, b ?
// XXX stub δT = map[Key]Value{}
for oid := range δZT { for oid := range δZT {
xa, err1 := zconnOld.Get(ctx, oid) xa, err1 := zconnOld.Get(ctx, oid)
xb, err2 := zconnNew.Get(ctx, oid) xb, err2 := zconnNew.Get(ctx, oid)
...@@ -342,8 +343,15 @@ func (δBtail *ΔBtail) treediff(ctx context.Context, root zodb.Oid, δZT SetOid ...@@ -342,8 +343,15 @@ func (δBtail *ΔBtail) treediff(ctx context.Context, root zodb.Oid, δZT SetOid
case *Bucket: case *Bucket:
b := xb.(*Bucket) // must not fail b := xb.(*Bucket) // must not fail
diffB(a, b) δb, err := diffB(ctx, a, b)
if err != nil {
return nil, err
}
for k,v := range δb {
δT[k] = v
}
// XXX stub
case *Tree: case *Tree:
b := xb.(*Tree) // must not fail b := xb.(*Tree) // must not fail
// TODO handle // TODO handle
...@@ -351,17 +359,28 @@ func (δBtail *ΔBtail) treediff(ctx context.Context, root zodb.Oid, δZT SetOid ...@@ -351,17 +359,28 @@ func (δBtail *ΔBtail) treediff(ctx context.Context, root zodb.Oid, δZT SetOid
} }
} }
return nil, nil // XXX stub return δT, nil
} }
// diffB computes difference in between two revisions of a bucket. // diffB computes difference in between two revisions of a bucket.
// the buckets must be already activated // the buckets must be already activated
func diffB(a, b *Bucket) (δ map[Key]Value, err error) { func diffB(ctx context.Context, a, b *Bucket) (δ map[Key]Value, err error) {
defer xerr.Contextf(&err, "diffB %s", a.POid()) defer xerr.Contextf(&err, "diffB %s", a.POid())
if a.POid() != b.POid() { if a.POid() != b.POid() {
panic("different buckets") panic("different buckets")
} }
err = a.PActivate(ctx)
if err != nil {
return nil, err
}
defer a.PDeactivate()
err = b.PActivate(ctx)
if err != nil {
return nil, err
}
defer b.PDeactivate()
av := a.Entryv() // key↑ av := a.Entryv() // key↑
bv := b.Entryv() // key↑ bv := b.Entryv() // key↑
δ = map[Key]Value{} δ = map[Key]Value{}
......
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