Commit e40c32c9 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e5e93e30
......@@ -148,21 +148,12 @@ func (tg *TreeGen) Commit(tree string) (_ zodb.Tid, err error) {
// XGetTree loads LOBtree from zurl@at->obj<root>.
// 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 {
//defer xerr.Contextf(&err, "%s: @%s: get tree %s", zurl, at, root)
defer exc.Contextf("%s: @%s: get tree %s", zurl, at, root)
func XGetTree(db *zodb.DB, at zodb.Tid, root zodb.Oid) map[int64]string {
defer exc.Contextf("%s: @%s: get tree %s", db.Storage().URL(), at, root)
X := exc.Raiseif
ctx := context.Background()
// XXX pass IStorage to here instead of zurl?
zstor, err := zodb.Open(ctx, zurl, &zodb.OpenOptions{ReadOnly: true}); X(err)
defer zstor.Close() // XXX err
db := zodb.NewDB(zstor)
defer db.Close() // XXX err
txn, ctx := transaction.New(ctx)
txn, ctx := transaction.New(context.Background())
defer txn.Abort()
zconn, err := db.Open(ctx, &zodb.ConnOptions{At: at}); X(err)
......@@ -218,6 +209,18 @@ func TestΔBTail(t *testing.T) {
err := tg.Close(); X(err)
}()
zstor, err := zodb.Open(context.Background(), tg.zurl, &zodb.OpenOptions{
ReadOnly: true,
}); X(err)
defer func() {
err := zstor.Close(); X(err)
}()
db := zodb.NewDB(zstor)
defer func() {
err := db.Close(); X(err)
}()
XXX := func(tree1, tree2 string) {
// XXX commit tree1
// XXX load tree1 -> get keys for kv1
......@@ -238,10 +241,10 @@ func TestΔBTail(t *testing.T) {
// verify δB has all keys as expected for tracked set
_, err := tg.Commit(tree1); X(err)
kv1 := XGetTree(tg.zurl, tg.head, tg.treeRoot)
kv1 := XGetTree(db, tg.head, tg.treeRoot)
fmt.Println(kv1)
_, err = tg.Commit(tree2); X(err)
kv2 := XGetTree(tg.zurl, tg.head, tg.treeRoot)
kv2 := XGetTree(db, tg.head, tg.treeRoot)
fmt.Println(kv2)
}
......
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