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
7dc564f5
Commit
7dc564f5
authored
Aug 06, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
53571524
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
23 deletions
+65
-23
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+15
-1
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+50
-22
No files found.
wcfs/internal/zdata/δftail.go
View file @
7dc564f5
...
...
@@ -157,12 +157,26 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
//
// XXX Track adds tree path to tracked set and associates path root with file.
//
//
XXX o
bjects in path and zblk must be with .PJar().At() == .head
//
O
bjects in path and zblk must be with .PJar().At() == .head
//
// A root can be associated with several files (each provided on different Track call).
func
(
δFtail
*
ΔFtail
)
Track
(
file
*
ZBigFile
,
blk
int64
,
path
[]
btree
.
LONode
,
zblk
ZBlk
)
{
// XXX locking
head
:=
δFtail
.
Head
()
fileAt
:=
file
.
PJar
()
.
At
()
if
fileAt
!=
head
{
panicf
(
"file.at (@%s) != δFtail.head (@%s)"
,
fileAt
,
head
)
}
if
zblk
!=
nil
{
zblkAt
:=
zblk
.
PJar
()
.
At
()
if
zblkAt
!=
head
{
panicf
(
"zblk.at (@%s) != δFtail.head (@%s)"
,
zblkAt
,
head
)
}
}
// path.at == head is verified by ΔBtail.Track
foid
:=
file
.
POid
()
if
blk
==
-
1
{
// XXX blk = ∞ from beginning ?
...
...
wcfs/internal/zdata/δftail_test.go
View file @
7dc564f5
...
...
@@ -626,14 +626,30 @@ func TestΔFtailSliceUntrackedUniform(t_ *testing.T) {
xat
[
at0
]
=
"at0"
δFtail
:=
NewΔFtail
(
at0
,
t
.
DB
)
// commit t1.
0 and 1
are in the same bucket.
t1
:=
t
.
CommitTree
(
"T/B0:a,1:b"
)
// commit t1.
all 0, 1 and 2
are in the same bucket.
t1
:=
t
.
CommitTree
(
"T/B0:a,1:b
,2:c
"
)
xat
[
t1
.
At
]
=
"at1"
δF
,
err
:=
δFtail
.
Update
(
t1
.
ΔZ
);
X
(
err
)
// XXX assert δF == ø
_
=
δF
t2
:=
t
.
CommitTree
(
"t0:d,1:e,2:c Da:a,b:b,c:c2,d:d,e:e"
)
// 0:-a+d 1:-b+e δc₂
xat
[
t2
.
At
]
=
"at2"
δF
,
err
=
δFtail
.
Update
(
t2
.
ΔZ
);
X
(
err
)
// XXX assert δF
t3
:=
t
.
CommitTree
(
"t0:d,1:e,2:c Da:a,b:b,c:c3,d:d3,e:e3"
)
// δc₃ δd₃ δe₃
xat
[
t3
.
At
]
=
"at3"
δF
,
err
=
δFtail
.
Update
(
t3
.
ΔZ
);
X
(
err
)
// XXX assert δF
t4
:=
t
.
CommitTree
(
"t0:d,1:e,2:c Da:a,b:b,c:c4,d:d3,e:e4"
)
// δc₄ δe₄
xat
[
t4
.
At
]
=
"at4"
δF
,
err
=
δFtail
.
Update
(
t4
.
ΔZ
);
X
(
err
)
// XXX assert δF
// load zfile via root['treegen/file']
// XXX dup
txn
,
ctx
:=
transaction
.
New
(
context
.
Background
())
...
...
@@ -681,34 +697,36 @@ func TestΔFtailSliceUntrackedUniform(t_ *testing.T) {
return
fmt
.
Sprintf
(
"%s"
,
s
)
}
// track 1, but do not track 0.
// blktab[0] becomes tracked by δBtail because both 0 and 1 are in the same bucket.
xtrackBlk
(
1
)
t2
:=
t
.
CommitTree
(
"t0:a,1:c Da:a2,b:b,c:c"
)
// 1: -b+c, δa₂
xat
[
t2
.
At
]
=
"at2"
δF
,
err
=
δFtail
.
Update
(
t2
.
ΔZ
);
X
(
err
)
// XXX assert δF
t3
:=
t
.
CommitTree
(
"t0:a,1:c Da:a3,b:b,c:c"
)
// δa₃
xat
[
t3
.
At
]
=
"at3"
δF
,
err
=
δFtail
.
Update
(
t3
.
ΔZ
);
X
(
err
)
// XXX assert δF
// track 0, but do not track 1 and 2.
// blktab[1] becomes noticed by δBtail because both 0 and 1 are in the same bucket and both are changed @at2.
// blktab[2] remains unnoticed because it is not changed past at1.
xtrackBlk
(
0
)
lo
:=
at0
hi
:=
t3
.
At
// (at1, at4]
lo
:=
t1
.
At
hi
:=
t4
.
At
vδf
:=
δFtail
.
SliceByFileRev
(
zfile
,
lo
,
hi
)
_01
:=
setI64
{};
_01
.
Add
(
0
);
_01
.
Add
(
1
)
vδf_ok
:=
[]
*
ΔFile
{
&
ΔFile
{
Rev
:
t
1
.
At
,
Blocks
:
_01
,
Size
:
true
},
&
ΔFile
{
Rev
:
t
2
.
At
,
Blocks
:
_01
,
Size
:
tru
e
},
&
ΔFile
{
Rev
:
t
3
.
At
,
Blocks
:
_01
,
Size
:
false
},
&
ΔFile
{
Rev
:
t
2
.
At
,
Blocks
:
b
(
0
,
1
)
,
Size
:
true
},
&
ΔFile
{
Rev
:
t
3
.
At
,
Blocks
:
b
(
0
,
1
),
Size
:
fals
e
},
&
ΔFile
{
Rev
:
t
4
.
At
,
Blocks
:
b
(
1
),
Size
:
false
},
}
if
!
reflect
.
DeepEqual
(
vδf
,
vδf_ok
)
{
t
.
Errorf
(
"slice (@%s,@%s]:
\n
have: %v
\n
want: %v"
,
xat
[
lo
],
xat
[
hi
],
vδfstr
(
vδf
),
vδfstr
(
vδf_ok
))
}
return
// XXX vvv correct
// (at2, at4]
lo
=
t2
.
At
vδf
=
δFtail
.
SliceByFileRev
(
zfile
,
lo
,
hi
)
vδf_ok
=
[]
*
ΔFile
{
&
ΔFile
{
Rev
:
t3
.
At
,
Blocks
:
b
(
0
,
1
),
Size
:
false
},
&
ΔFile
{
Rev
:
t4
.
At
,
Blocks
:
b
(
1
),
Size
:
false
},
}
}
...
...
@@ -734,3 +752,13 @@ func dataTabTxt(dataTab map[string]string) string {
return
strings
.
Join
(
sv
,
","
)
}
// b is shorthand to create setI64(blocks).
func
b
(
blocks
...
int64
)
setI64
{
s
:=
setI64
{}
for
_
,
blk
:=
range
blocks
{
s
.
Add
(
blk
)
}
return
s
}
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