Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
86070cba
Commit
86070cba
authored
May 31, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c98d3f92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
28 deletions
+32
-28
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+32
-28
No files found.
wcfs/δbtail_test.go
View file @
86070cba
...
@@ -35,10 +35,10 @@ import (
...
@@ -35,10 +35,10 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb"
)
)
// TreeGen represents connection to running `treegen trees`.
// TreeGen represents connection to running `treegen trees`
server
.
//
//
// Create it with StartTreeGen(zurl).
// Create it with StartTreeGen(zurl).
// - Commit(treeTopology) ->
// - Commit(treeTopology) ->
tid
type
TreeGen
struct
{
type
TreeGen
struct
{
zurl
string
zurl
string
pysrv
*
exec
.
Cmd
// spawned `treegen trees`
pysrv
*
exec
.
Cmd
// spawned `treegen trees`
...
@@ -104,7 +104,7 @@ func StartTreeGen(zurl string) (_ *TreeGen, err error) {
...
@@ -104,7 +104,7 @@ func StartTreeGen(zurl string) (_ *TreeGen, err error) {
return
nil
,
fmt
.
Errorf
(
"root: %s"
,
err
)
return
nil
,
fmt
.
Errorf
(
"root: %s"
,
err
)
}
}
fmt
.
Printf
(
"XXX started @%s root=%s
\n
"
,
tg
.
head
,
tg
.
treeRoot
)
//
fmt.Printf("XXX started @%s root=%s\n", tg.head, tg.treeRoot)
return
tg
,
nil
return
tg
,
nil
}
}
...
@@ -140,34 +140,13 @@ func (tg *TreeGen) Commit(tree string) (_ zodb.Tid, err error) {
...
@@ -140,34 +140,13 @@ func (tg *TreeGen) Commit(tree string) (_ zodb.Tid, err error) {
return
tid
,
nil
return
tid
,
nil
}
}
// XXX
func
XXX
(
t
*
testing
.
T
,
tree1
,
tree2
string
)
{
// XXX commit tree1
// XXX load tree1 -> get keys for kv1
//
// XXX for all set of {keys} from kv1:
// // prepare initial state with {keys} tracked
// zconn = db.open(at)
// δbtail = NewΔBTail(zconn.At())
// for k in keys:
// v, path = tree.VGet(k)
// δbtail.Track(path)
//
// commit(->tree2)
// δZ = ...
//
// δB = δbtail.Update(δZ)
//
// verify δB has all keys as expected for tracked set
}
func
TestΔBTail
(
t
*
testing
.
T
)
{
func
TestΔBTail
(
t
*
testing
.
T
)
{
X
:=
exc
.
Raiseif
X
:=
exc
.
Raiseif
// XXX test known cases tree1 -> tree2
// XXX test known cases tree1 -> tree2
testv
:=
[]
struct
{
tree1
,
tree2
string
}
{
testv
:=
[]
struct
{
tree1
,
tree2
string
}
{
{
"T/B
"
,
"T/B
"
},
{
"T/B
:"
,
"T/B:
"
},
{
"T/B
"
,
"T/B1:a"
},
{
"T/B
:"
,
"T/B1:a"
},
// XXX
// XXX
}
}
...
@@ -180,9 +159,34 @@ func TestΔBTail(t *testing.T) {
...
@@ -180,9 +159,34 @@ func TestΔBTail(t *testing.T) {
err
:=
tg
.
Close
();
X
(
err
)
err
:=
tg
.
Close
();
X
(
err
)
}()
}()
XXX
:=
func
(
tree1
,
tree2
string
)
{
// XXX commit tree1
// XXX load tree1 -> get keys for kv1
//
// XXX for all set of {keys} from kv1:
// // prepare initial state with {keys} tracked
// zconn = db.open(at)
// δbtail = NewΔBTail(zconn.At())
// for k in keys:
// v, path = tree.VGet(k)
// δbtail.Track(path)
//
// commit(->tree2)
// δZ = ...
//
// δB = δbtail.Update(δZ)
//
// verify δB has all keys as expected for tracked set
tid
,
err
:=
tg
.
Commit
(
tree1
);
X
(
err
)
tid
,
err
=
tg
.
Commit
(
tree2
);
X
(
err
)
_
=
tid
}
for
_
,
test
:=
range
testv
{
for
_
,
test
:=
range
testv
{
XXX
(
t
,
t
est
.
tree1
,
test
.
tree2
)
XXX
(
test
.
tree1
,
test
.
tree2
)
XXX
(
t
,
t
est
.
tree2
,
test
.
tree1
)
XXX
(
test
.
tree2
,
test
.
tree1
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment