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
a4b4a175
Commit
a4b4a175
authored
Jun 02, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e6e5b9ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
4 deletions
+34
-4
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+34
-4
No files found.
wcfs/δbtail_test.go
View file @
a4b4a175
...
@@ -67,6 +67,14 @@ type TreeSrv struct {
...
@@ -67,6 +67,14 @@ type TreeSrv struct {
head
zodb
.
Tid
// last made commit
head
zodb
.
Tid
// last made commit
}
}
// AllStructsSrv represents connection to running `treegen allstructs.srv` server.
//
// Create it with StartAllStructsSrv().
// - AllStructs(maxdepth, maxsplit, n, seed, kv1, kv2)
type
AllStructsSrv
struct
{
*
TreeGenSrv
}
// StartTreeGenSrv spawns `treegen ...` server.
// StartTreeGenSrv spawns `treegen ...` server.
func
StartTreeGenSrv
(
argv
...
string
)
(
_
*
TreeGenSrv
,
hello
string
,
err
error
)
{
func
StartTreeGenSrv
(
argv
...
string
)
(
_
*
TreeGenSrv
,
hello
string
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treesrv %v: start"
,
argv
)
defer
xerr
.
Contextf
(
&
err
,
"treesrv %v: start"
,
argv
)
...
@@ -105,15 +113,13 @@ func StartTreeGenSrv(argv ...string) (_ *TreeGenSrv, hello string, err error) {
...
@@ -105,15 +113,13 @@ func StartTreeGenSrv(argv ...string) (_ *TreeGenSrv, hello string, err error) {
return
nil
,
""
,
err
return
nil
,
""
,
err
}
}
hello
=
strings
.
TrimSuffix
(
hello
,
"
\n
"
)
hello
=
strings
.
TrimSuffix
(
hello
,
"
\n
"
)
defer
xerr
.
Contextf
(
&
err
,
"invalid hello %q"
,
hello
)
return
tg
,
hello
,
nil
return
tg
,
hello
,
nil
}
}
// StartTreeSrv spawns `treegen trees` server.
// StartTreeSrv spawns `treegen trees` server.
func
StartTreeSrv
(
zurl
string
)
(
_
*
TreeSrv
,
err
error
)
{
func
StartTreeSrv
(
zurl
string
)
(
_
*
TreeSrv
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treesrv %s: start"
,
zurl
)
defer
xerr
.
Contextf
(
&
err
,
"tree.srv %s: start"
,
zurl
)
tgSrv
,
hello
,
err
:=
StartTreeGenSrv
(
"trees"
,
zurl
)
tgSrv
,
hello
,
err
:=
StartTreeGenSrv
(
"trees"
,
zurl
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -125,9 +131,9 @@ func StartTreeSrv(zurl string) (_ *TreeSrv, err error) {
...
@@ -125,9 +131,9 @@ func StartTreeSrv(zurl string) (_ *TreeSrv, err error) {
tgSrv
.
Close
()
// ignore error
tgSrv
.
Close
()
// ignore error
}
}
}()
}()
defer
xerr
.
Context
(
&
err
,
"handshake"
)
// tree.srv start @<at> tree=<root>
// tree.srv start @<at> tree=<root>
defer
xerr
.
Contextf
(
&
err
,
"invalid hello %q"
,
hello
)
startRe
:=
regexp
.
MustCompile
(
`^tree.srv start @([^ ]+) root=([^ ]+)$`
)
startRe
:=
regexp
.
MustCompile
(
`^tree.srv start @([^ ]+) root=([^ ]+)$`
)
m
:=
startRe
.
FindStringSubmatch
(
hello
)
m
:=
startRe
.
FindStringSubmatch
(
hello
)
if
m
==
nil
{
if
m
==
nil
{
...
@@ -145,6 +151,30 @@ func StartTreeSrv(zurl string) (_ *TreeSrv, err error) {
...
@@ -145,6 +151,30 @@ func StartTreeSrv(zurl string) (_ *TreeSrv, err error) {
return
tg
,
nil
return
tg
,
nil
}
}
// StartAllStructsSrv spwans `treegen allstructs.srv` server.
func
StartAllStructsSrv
()
(
_
*
AllStructsSrv
,
err
error
)
{
defer
xerr
.
Context
(
&
err
,
"allstructs.srv: start"
)
tgSrv
,
hello
,
err
:=
StartTreeGenSrv
(
"allstructs.srv"
)
if
err
!=
nil
{
return
nil
,
err
}
sg
:=
&
AllStructsSrv
{
TreeGenSrv
:
tgSrv
}
defer
func
()
{
if
err
!=
nil
{
tgSrv
.
Close
()
// ignore error
}
}()
defer
xerr
.
Contextf
(
&
err
,
"invalid hello %q"
,
hello
)
if
hello
!=
"# allstructs.srv startQ"
{
return
nil
,
fmt
.
Errorf
(
"unexpected format"
)
}
return
sg
,
nil
}
// Close shutdowns treegen server.
// Close shutdowns treegen server.
func
(
tg
*
TreeGenSrv
)
Close
()
(
err
error
)
{
func
(
tg
*
TreeGenSrv
)
Close
()
(
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treegen %v: close"
,
tg
.
argv
)
defer
xerr
.
Contextf
(
&
err
,
"treegen %v: close"
,
tg
.
argv
)
...
...
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