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
caa0240f
Commit
caa0240f
authored
Jul 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9eef8bdd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
18 deletions
+23
-18
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+23
-18
No files found.
wcfs/internal/zdata/δftail_test.go
View file @
caa0240f
...
...
@@ -195,13 +195,6 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
}
zfile
.
PDeactivate
()
// track zfile[-∞,∞) from the beginning
// this should make ΔFtail to see all zfile changes
size
,
path
,
err
:=
zfile
.
Size
(
ctx
);
X
(
err
)
δFtail
.
Track
(
zfile
,
/*blk*/
-
1
,
path
,
/*zblk*/
nil
)
if
size
!=
0
{
t
.
Fatalf
(
"BUG: zfile is not initially empty: size=%d"
,
size
)
}
// data built via applying changes from testv
vδf
:=
[]
*
ΔFile
{}
// (rev↑, {}blk)
...
...
@@ -215,20 +208,27 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
dataTab
[
zblki
.
Name
]
=
zblki
.
Data
}
xat
:=
map
[
zodb
.
Tid
]
string
{}
// tid > "at<i>"
xat
[
δFtail
.
Head
()]
=
"at0"
t
.
Logf
(
"# @at0 (%s)"
,
δFtail
.
Head
())
// vector of epochs and func to create a new one
epochv
:=
[]
zodb
.
Tid
{
0
}
onNewEpoch
:=
func
(
epoch
zodb
.
Tid
)
{
epochv
=
append
(
epochv
,
epoch
)
// track zfile[-∞,∞) from the beginning
// this should make ΔFtail to see all zfile changes
size
,
path
,
err
:=
zfile
.
Size
(
ctx
);
X
(
err
)
δFtail
.
Track
(
zfile
,
/*blk*/
-
1
,
path
,
/*zblk*/
nil
)
if
size
!=
0
{
t
.
Fatalf
(
"BUG: zfile is not initially empty: size=%d"
,
size
)
}
// retrack should be called after new epoch to track zfile[-∞,∞) again
retrack
:=
func
()
{
for
blk
:=
range
blkTab
{
_
,
path
,
zblk
,
_
,
err
:=
zfile
.
LoadBlk
(
ctx
,
blk
);
X
(
err
)
δFtail
.
Track
(
zfile
,
blk
,
path
,
zblk
)
}
}
xat
:=
map
[
zodb
.
Tid
]
string
{}
// tid > "at<i>"
xat
[
δFtail
.
Head
()]
=
"at0"
t
.
Logf
(
"# @at0 (%s)"
,
δFtail
.
Head
())
epochv
:=
[]
zodb
.
Tid
{
0
}
// δfstr/vδfstr converts δf/vδf to string taking xat into account
δfstr
:=
func
(
δf
*
ΔFile
)
string
{
s
:=
fmt
.
Sprintf
(
"@%s·%s"
,
xat
[
δf
.
Rev
],
δf
.
Blocks
)
...
...
@@ -325,6 +325,9 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
req
=
tTxt
+
" "
+
dTxt
}
commit
:=
t
.
CommitTree
(
req
)
if
newEpoch
{
epochv
=
append
(
epochv
,
commit
.
At
)
}
// update blkRevAt
var
blkRevPrev
map
[
int64
]
zodb
.
Tid
...
...
@@ -369,9 +372,6 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
// update δFtail
δF
,
err
:=
δFtail
.
Update
(
commit
.
ΔZ
);
X
(
err
)
if
newEpoch
{
onNewEpoch
(
commit
.
At
)
}
// assert δF points to the file if δfok != ø
if
δF
.
Rev
!=
commit
.
At
{
...
...
@@ -396,6 +396,11 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
t
.
Errorf
(
"δf:
\n
have: %v
\n
want: %v"
,
δf
,
δfok
)
}
// track whole zfile again if new epoch was started
if
newEpoch
{
retrack
()
}
// verify δFtail.trackSetZBlk
trackZinblk
:=
map
[
string
]
setI64
{}
for
oid
,
zt
:=
range
δFtail
.
trackSetZBlk
{
...
...
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