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
6356b4ae
Commit
6356b4ae
authored
Jul 16, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3cc8369b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
3 deletions
+41
-3
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+22
-0
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+19
-3
No files found.
wcfs/internal/zdata/δftail.go
View file @
6356b4ae
...
...
@@ -374,6 +374,28 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
// ForgetPast discards all δFtail entries with rev ≤ revCut.
func
(
δFtail
*
ΔFtail
)
ForgetPast
(
revCut
zodb
.
Tid
)
{
δFtail
.
δBtail
.
ForgetPast
(
revCut
)
// XXX locking
// XXX keep index which file changed epoch where (similarly to ΔBtail),
// and, instead of scanning all files, trim vδE only on files that is really necessary.
for
_
,
δftail
:=
range
δFtail
.
byFile
{
δftail
.
forgetPast
(
revCut
)
}
}
func
(
δftail
*
_ΔFileTail
)
forgetPast
(
revCut
zodb
.
Tid
)
{
// XXX locking
icut
:=
0
for
;
icut
<
len
(
δftail
.
vδE
);
icut
++
{
if
δftail
.
vδE
[
icut
]
.
Rev
>
revCut
{
break
}
}
// vδE[:icut] should be forgotten
if
icut
>
0
{
// XXX workarond for ΔFtail.ForgetPast calling forgetPast on all files
δftail
.
vδE
=
append
([]
_ΔFileEpoch
(
nil
),
δftail
.
vδE
[
icut
:
]
...
)
}
}
// XXX don't need
...
...
wcfs/internal/zdata/δftail_test.go
View file @
6356b4ae
...
...
@@ -177,6 +177,9 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
t
:=
xbtreetest
.
NewT
(
t_
)
X
:=
exc
.
Raiseif
// XXX start δFtail when zfile is not yet exists
// this way we'll verify how ΔFtail rebuilds vδE for started-to-be-tracked file
δFtail
:=
NewΔFtail
(
t
.
Head
()
.
At
,
t
.
DB
)
// load zfile via root['treegen/file']
...
...
@@ -187,7 +190,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
err
=
zroot
.
PActivate
(
ctx
);
X
(
err
)
zfile
:=
zroot
.
Data
[
"treegen/file"
]
.
(
*
ZBigFile
)
zroot
.
PDeactivate
()
zfileO
id
:=
zfile
.
POid
()
fo
id
:=
zfile
.
POid
()
err
=
zfile
.
PActivate
(
ctx
);
X
(
err
)
blktabOid
:=
zfile
.
blktab
.
POid
()
if
blktabOid
!=
t
.
Root
()
{
...
...
@@ -400,7 +403,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
}
δfilesOK
:=
setOid
{}
if
δfok
!=
nil
{
δfilesOK
.
Add
(
zfileO
id
)
δfilesOK
.
Add
(
fo
id
)
}
if
!
δfiles
.
Equal
(
δfilesOK
)
{
t
.
Errorf
(
"wrong δF.ByFile:
\n
have keys: %s
\n
want keys: %s"
,
δfiles
,
δfilesOK
)
...
...
@@ -408,7 +411,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
}
// verify δf
δf
:=
δF
.
ByFile
[
zfileO
id
]
δf
:=
δF
.
ByFile
[
fo
id
]
if
!
reflect
.
DeepEqual
(
δf
,
δfok
)
{
t
.
Errorf
(
"δf:
\n
have: %v
\n
want: %v"
,
δf
,
δfok
)
}
...
...
@@ -451,6 +454,19 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
//t.Logf("# vδt: %s", vδfstr(δFtail.SliceByFileRev(zfile, δFtail.Tail(), δFtail.Head())))
}
// verify vδE
vδEok
:=
[]
_ΔFileEpoch
{}
for
_
,
δf
:=
range
vδf
{
if
δf
.
Epoch
{
vδEok
=
append
(
vδEok
,
_ΔFileEpoch
{
Rev
:
δf
.
Rev
})
// XXX + root,size
}
}
δftail
:=
δFtail
.
byFile
[
foid
]
if
!
reflect
.
DeepEqual
(
δftail
.
vδE
,
vδEok
)
{
t
.
Errorf
(
"vδE:
\n
have: %v
\n
want: %v"
,
δftail
.
vδE
,
vδEok
)
}
// SliceByFileRev
for
j
:=
0
;
j
<
len
(
vδf
);
j
++
{
for
k
:=
j
;
k
<
len
(
vδf
);
k
++
{
...
...
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