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
c0e34350
Commit
c0e34350
authored
Jul 09, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
67fbcf8e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
21 deletions
+53
-21
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+50
-18
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+3
-3
No files found.
wcfs/internal/zdata/δftail.go
View file @
c0e34350
...
...
@@ -96,8 +96,7 @@ type ΔFtail struct {
// zblkTrack keeps information in which root/blocks ZBlk is present as of @head.
type
zblkTrack
struct
{
// inroot map[zodb.Oid]setI64 // {} root -> {}blk XXX later switch to this
infile
map
[
zodb
.
Oid
]
setI64
// {} foid -> {}blk
inroot
map
[
zodb
.
Oid
]
setI64
// {} root -> {}blk XXX later switch to this
}
// ΔF represents a change in files space.
...
...
@@ -162,10 +161,11 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, zb
}
root
:=
path
[
0
]
.
(
*
btree
.
LOBTree
)
files
,
ok
:=
δFtail
.
fileIdx
[
root
.
POid
()]
roid
:=
root
.
POid
()
files
,
ok
:=
δFtail
.
fileIdx
[
roid
]
if
!
ok
{
files
=
setOid
{}
δFtail
.
fileIdx
[
ro
ot
.
POid
()
]
=
files
δFtail
.
fileIdx
[
ro
id
]
=
files
}
files
.
Add
(
foid
)
...
...
@@ -180,15 +180,15 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, zb
δFtail
.
trackSetZBlk
[
zoid
]
=
zt
}
blocks
,
ok
:=
zt
.
infile
[
f
oid
]
inblk
,
ok
:=
zt
.
inroot
[
r
oid
]
if
!
ok
{
blocks
=
make
(
setI64
,
1
)
if
zt
.
in
file
==
nil
{
zt
.
in
file
=
make
(
map
[
zodb
.
Oid
]
setI64
)
inblk
=
make
(
setI64
,
1
)
if
zt
.
in
root
==
nil
{
zt
.
in
root
=
make
(
map
[
zodb
.
Oid
]
setI64
)
}
zt
.
in
file
[
foid
]
=
blocks
zt
.
in
root
[
roid
]
=
inblk
}
blocks
.
Add
(
blk
)
inblk
.
Add
(
blk
)
if
!
ok
{
// zblk was not associated with this file
...
...
@@ -249,7 +249,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
setI64
)}
δF
.
ByFile
[
file
]
=
δfile
}
for
blk
/*, zblk*/
:=
range
δt
{
for
blk
/*,
δ
zblk*/
:=
range
δt
{
// XXX document, and in particular how to include atTail
δfile
.
Blocks
.
Add
(
blk
)
}
...
...
@@ -260,6 +260,36 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
// XXX currently we invalidate size on any topology change.
δfile
.
Size
=
true
}
// update trackSetZBlk according to btree changes
for
blk
,
δzblk
:=
range
δt
{
if
δzblk
.
Old
!=
xbtree
.
VDEL
{
ztOld
,
ok
:=
δFtail
.
trackSetZBlk
[
δzblk
.
Old
]
if
ok
{
inblk
,
ok
:=
ztOld
.
inroot
[
root
]
if
ok
{
inblk
.
Del
(
blk
)
}
}
}
if
δzblk
.
New
!=
xbtree
.
VDEL
{
ztNew
,
ok
:=
δFtail
.
trackSetZBlk
[
δzblk
.
New
]
if
!
ok
{
ztNew
=
&
zblkTrack
{}
δFtail
.
trackSetZBlk
[
δzblk
.
New
]
=
ztNew
}
inblk
,
ok
:=
ztNew
.
inroot
[
root
]
if
!
ok
{
inblk
=
make
(
setI64
,
1
)
if
ztNew
.
inroot
==
nil
{
ztNew
.
inroot
=
make
(
map
[
zodb
.
Oid
]
setI64
)
}
ztNew
.
inroot
[
root
]
=
inblk
}
inblk
.
Add
(
blk
)
}
}
}
// take zblk changes into account
...
...
@@ -276,17 +306,18 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
continue
// not tracked
}
for
foid
,
blocks
:=
range
zt
.
infile
{
δfile
,
ok
:=
δF
.
ByFile
[
foid
]
for
root
,
inblk
:=
range
zt
.
inroot
{
files
:=
δFtail
.
fileIdx
[
root
]
for
file
:=
range
files
{
δfile
,
ok
:=
δF
.
ByFile
[
file
]
if
!
ok
{
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
setI64
)}
δF
.
ByFile
[
foid
]
=
δfile
δF
.
ByFile
[
file
]
=
δfile
}
δfile
.
Blocks
.
Update
(
blocks
)
δfile
.
Blocks
.
Update
(
inblk
)
}
}
// XXX update zt.infile according to btree changes
}
δFtail
.
vδF
=
append
(
δFtail
.
vδF
,
δF
)
...
...
@@ -334,7 +365,8 @@ func (δFtail *ΔFtail) update(file *ZBigFile) {
δF
.
ByFile
[
foid
]
=
δfile
}
δfile
.
Blocks
.
Update
(
z
.
infile
[
foid
])
// δfile.Blocks.Update(z.infile[foid])
δfile
.
Blocks
.
Update
(
z
.
inroot
[
file
.
blktab
.
POid
()])
// XXX need .blktab.PActivate
}
}
}
...
...
wcfs/internal/zdata/δftail_test.go
View file @
c0e34350
...
...
@@ -203,9 +203,9 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
trackZinblk
:=
map
[
string
]
setI64
{}
for
oid
,
zt
:=
range
δftail
.
trackSetZBlk
{
zblki
:=
commit
.
ZBlkTab
[
oid
]
for
foid
,
blocks
:=
range
zt
.
infile
{
if
foid
!=
zfileOid
{
t
.
Errorf
(
".trackSetZBlk: zblk %s points to unexpected
file %s"
,
zblki
.
Name
,
foid
)
for
root
,
blocks
:=
range
zt
.
inroot
{
if
root
!=
zfile
.
blktab
.
POid
()
{
t
.
Errorf
(
".trackSetZBlk: zblk %s points to unexpected
blktab %s"
,
zblki
.
Name
,
zfile
.
blktab
.
POid
()
)
continue
}
...
...
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