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
05974da5
Commit
05974da5
authored
Jun 02, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a4b4a175
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
10 deletions
+44
-10
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+44
-10
No files found.
wcfs/δbtail_test.go
View file @
05974da5
...
...
@@ -46,6 +46,7 @@ import (
"github.com/stretchr/testify/require"
)
// XXX move infrastructure -> δbtail_treegen_test.go ?
// TreeGenSrv represents connection to running `treegen ...` server.
type
TreeGenSrv
struct
{
...
...
@@ -117,6 +118,17 @@ func StartTreeGenSrv(argv ...string) (_ *TreeGenSrv, hello string, err error) {
return
tg
,
hello
,
nil
}
// Close shutdowns treegen server.
func
(
tg
*
TreeGenSrv
)
Close
()
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treegen %v: close"
,
tg
.
argv
)
err1
:=
tg
.
pyin
.
Close
()
err2
:=
tg
.
pyoutRaw
.
Close
()
err3
:=
tg
.
pysrv
.
Wait
()
return
xerr
.
Merge
(
err1
,
err2
,
err3
)
}
// StartTreeSrv spawns `treegen trees` server.
func
StartTreeSrv
(
zurl
string
)
(
_
*
TreeSrv
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"tree.srv %s: start"
,
zurl
)
...
...
@@ -175,19 +187,10 @@ func StartAllStructsSrv() (_ *AllStructsSrv, err error) {
return
sg
,
nil
}
// Close shutdowns treegen server.
func
(
tg
*
TreeGenSrv
)
Close
()
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treegen %v: close"
,
tg
.
argv
)
err1
:=
tg
.
pyin
.
Close
()
err2
:=
tg
.
pyoutRaw
.
Close
()
err3
:=
tg
.
pysrv
.
Wait
()
return
xerr
.
Merge
(
err1
,
err2
,
err3
)
}
// Commit creates new commit with underlying tree changed to specified tree topology.
func
(
tg
*
TreeSrv
)
Commit
(
tree
string
)
(
_
zodb
.
Tid
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"tree
gen
%s: commit %s"
,
tg
.
zurl
,
tree
)
defer
xerr
.
Contextf
(
&
err
,
"tree
.srv
%s: commit %s"
,
tg
.
zurl
,
tree
)
_
,
err
=
io
.
WriteString
(
tg
.
pyin
,
tree
+
"
\n
"
)
if
err
!=
nil
{
...
...
@@ -208,6 +211,37 @@ func (tg *TreeSrv) Commit(tree string) (_ zodb.Tid, err error) {
return
tid
,
nil
}
// AllStructs returns response from `treegen allstructs`
func
(
tg
*
AllStructsSrv
)
AllStructs
(
kv1
,
kv2
map
[
Key
]
string
,
maxdepth
,
maxsplit
,
n
int
,
seed
int64
)
(
_
[]
string
,
err
error
)
{
req
:=
fmt
.
Sprintf
(
"%d %d %d/%d %s %s"
,
maxdepth
,
maxsplit
,
n
,
seed
,
kvtxt
(
kv1
),
kvtxt
(
kv2
))
defer
xerr
.
Contextf
(
&
err
,
"allstructs.srv: %s"
,
req
)
_
,
err
=
io
.
WriteString
(
tg
.
pyin
,
req
+
"
\n
"
)
if
err
!=
nil
{
return
nil
,
err
}
structv
:=
[]
string
{}
for
{
reply
,
err
:=
tg
.
pyout
.
ReadString
(
'\n'
)
if
err
!=
nil
{
return
nil
,
err
}
reply
=
strings
.
TrimSuffix
(
reply
,
"
\n
"
)
if
reply
==
"# ----"
{
return
structv
,
nil
// end of response
}
if
strings
.
HasPrefix
(
reply
,
"#"
)
{
continue
// comment
}
structv
=
append
(
structv
,
reply
)
}
}
// XGetTree loads Tree from zurl@at->obj<root>.
// Tree values must be ZBlk whose data is returned instead of references to ZBlk objects.
...
...
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