Commit f473db65 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8a1d3f7c
...@@ -144,10 +144,11 @@ func (tg *TreeGen) Commit(tree string) (_ zodb.Tid, err error) { ...@@ -144,10 +144,11 @@ func (tg *TreeGen) Commit(tree string) (_ zodb.Tid, err error) {
} }
// GetTree loads LOBtree from zurl@at->obj<root>. // XGetTree loads LOBtree from zurl@at->obj<root>.
// Tree values must be ZBlk whose data is returned instead of references to ZBlk. // Tree values must be ZBlk whose data is returned instead of references to ZBlk.
func XGetTree(zurl string, at zodb.Tid, root zodb.Oid) (_ map[int64]string, err error) { func XGetTree(zurl string, at zodb.Tid, root zodb.Oid) map[int64]string {
defer xerr.Contextf(&err, "%s: @%s: get tree %s", zurl, at, root) //defer xerr.Contextf(&err, "%s: @%s: get tree %s", zurl, at, root)
defer exc.Contextf("%s: @%s: get tree %s", zurl, at, root)
X := exc.Raiseif X := exc.Raiseif
ctx := context.Background() ctx := context.Background()
...@@ -166,7 +167,7 @@ func XGetTree(zurl string, at zodb.Tid, root zodb.Oid) (_ map[int64]string, err ...@@ -166,7 +167,7 @@ func XGetTree(zurl string, at zodb.Tid, root zodb.Oid) (_ map[int64]string, err
xztree, err := zconn.Get(ctx, root); X(err) xztree, err := zconn.Get(ctx, root); X(err)
ztree, ok := xztree.(*btree.LOBTree) ztree, ok := xztree.(*btree.LOBTree)
if !ok { if !ok {
return nil, fmt.Errorf("expected LOBTree, got %s", zodb.ClassOf(xztree)) exc.Raisef("expected LOBTree, got %s", zodb.ClassOf(xztree))
} }
err = ztree.PActivate(ctx); X(err) err = ztree.PActivate(ctx); X(err)
...@@ -183,7 +184,7 @@ func XGetTree(zurl string, at zodb.Tid, root zodb.Oid) (_ map[int64]string, err ...@@ -183,7 +184,7 @@ func XGetTree(zurl string, at zodb.Tid, root zodb.Oid) (_ map[int64]string, err
xv := __.Value() xv := __.Value()
zv, ok := xv.(zBlk) zv, ok := xv.(zBlk)
if !ok { if !ok {
return nil, fmt.Errorf("[%d] -> %s; want ZBlk", k, typeOf(xv)) exc.Raisef("[%d] -> %s; want ZBlk", k, typeOf(xv))
} }
data, _, err := zv.loadBlkData(ctx); X(err) data, _, err := zv.loadBlkData(ctx); X(err)
...@@ -193,7 +194,7 @@ func XGetTree(zurl string, at zodb.Tid, root zodb.Oid) (_ map[int64]string, err ...@@ -193,7 +194,7 @@ func XGetTree(zurl string, at zodb.Tid, root zodb.Oid) (_ map[int64]string, err
zbucket = zbucket.Next() zbucket = zbucket.Next()
} }
return kv, nil return kv
} }
func TestΔBTail(t *testing.T) { func TestΔBTail(t *testing.T) {
......
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