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
47e0730a
Commit
47e0730a
authored
Oct 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b3a7ce65
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
45 deletions
+43
-45
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+25
-22
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+18
-23
No files found.
wcfs/internal/zdata/δftail.go
View file @
47e0730a
...
...
@@ -146,25 +146,13 @@ type ΔFtail struct {
byFile
map
[
zodb
.
Oid
]
*
_ΔFileTail
// file -> vδf tail
byRoot
map
[
zodb
.
Oid
]
*
_RootTrack
// tree-root -> ({foid}, Zinblk) as of @head
// filesByRoot map[zodb.Oid]setOid // tree-root -> {} ZBigFile<oid> as of @head
// set of files, which are newly tracked and for which byFile[foid].vδE was not yet rebuilt
ftrackNew
setOid
// {}foid
// set of tracked ZBlk objects mapped to trees as of @head
// XXX -> Zinroot ? ztrackInRoot ?
ztrackInRoots
map
[
zodb
.
Oid
]
setOid
// {} zblk -> {}root
/*
// set of tracked ZBlk objects reverse-mapped to trees and block numbers
//
// XXX split -> :
// ΔFtail.trackSetZBlkRoots {} zblk -> {root}
// δftail.trackSetZBlkBlocks {} zblk -> {blk} in tha file/root (shared by all files with same root ?)
trackSetZBlk map[zodb.Oid]*zblkTrack // zblk -> {} root -> {}blk as of @head
ztrackRoots
*/
// XXX -> ztrackInRoot ?
zinroot
map
[
zodb
.
Oid
]
setOid
// {} zblk -> {}root
}
// _ΔFileTail represents tail of revisional changes to one file.
...
...
@@ -184,14 +172,15 @@ type _ΔFileEpoch struct {
newBlkSize
int64
// .blksize was changed to newBlkSize ; ----//----
// snapshot of trackSetZBlk for this file right before this epoch
// oldTrackSetZBlk map[zodb.Oid]setI64 // {} zblk -> {}blk
oldZinblk
map
[
zodb
.
Oid
]
setI64
// {} zblk -> {}blk
}
// _RootTrack represents tracking information about one particular tree as of @head.
// XXX -> _TreeTrack ? _BlktabTrack ?
type
_RootTrack
struct
{
// XXX -> ftrackSet ?
files
setOid
// {}foid which ZBigFiles refer to this tree
// XXX -> ztrackInBlk ?
Zinblk
map
[
zodb
.
Oid
]
setI64
// {} zblk -> {}blk which blocks map to zblk
}
...
...
@@ -237,7 +226,7 @@ func NewΔFtail(at0 zodb.Tid, db *zodb.DB) *ΔFtail {
byFile
:
map
[
zodb
.
Oid
]
*
_ΔFileTail
{},
byRoot
:
map
[
zodb
.
Oid
]
*
_RootTrack
{},
ftrackNew
:
setOid
{},
z
trackInRoots
:
map
[
zodb
.
Oid
]
setOid
{},
z
inroot
:
map
[
zodb
.
Oid
]
setOid
{},
}
}
...
...
@@ -307,10 +296,10 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, bl
if
zblk
!=
nil
{
zoid
:=
zblk
.
POid
()
inroot
,
ok
:=
δFtail
.
z
trackInRoots
[
zoid
]
inroot
,
ok
:=
δFtail
.
z
inroot
[
zoid
]
if
!
ok
{
inroot
=
make
(
setOid
,
1
)
δFtail
.
z
trackInRoots
[
zoid
]
=
inroot
δFtail
.
z
inroot
[
zoid
]
=
inroot
}
inroot
.
Add
(
root
)
...
...
@@ -455,7 +444,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
if
ok
{
for
zoid
,
inblk
:=
range
rt
.
Zinblk
{
δE
.
oldZinblk
[
zoid
]
=
inblk
.
Clone
()
inroot
,
ok
:=
δFtail
.
z
trackInRoots
[
zoid
]
inroot
,
ok
:=
δFtail
.
z
inroot
[
zoid
]
if
ok
{
inroot
.
Del
(
δftail
.
root
)
}
...
...
@@ -502,8 +491,15 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
inblk
,
ok
:=
rt
.
Zinblk
[
δzblk
.
Old
]
if
ok
{
inblk
.
Del
(
blk
)
if
len
(
inblk
)
==
0
{
delete
(
rt
.
Zinblk
,
δzblk
.
Old
)
inroot
:=
δFtail
.
zinroot
[
δzblk
.
Old
]
inroot
.
Del
(
root
)
if
len
(
inroot
)
==
0
{
delete
(
δFtail
.
zinroot
,
δzblk
.
Old
)
}
}
}
// XXX update Zinroot (potentially del)
}
if
δzblk
.
New
!=
xbtree
.
VDEL
{
...
...
@@ -511,16 +507,21 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
if
!
ok
{
inblk
=
make
(
setI64
,
1
)
rt
.
Zinblk
[
δzblk
.
New
]
=
inblk
inroot
,
ok
:=
δFtail
.
zinroot
[
δzblk
.
New
]
if
!
ok
{
inroot
=
make
(
setOid
,
1
)
δFtail
.
zinroot
[
δzblk
.
New
]
=
inroot
}
inroot
.
Add
(
root
)
}
inblk
.
Add
(
blk
)
// XXX update Zinroot (add)
}
}
}
// take zblk changes into account
for
_
,
oid
:=
range
δZ
.
Changev
{
inroot
,
ok
:=
δFtail
.
z
trackInRoots
[
oid
]
inroot
,
ok
:=
δFtail
.
z
inroot
[
oid
]
if
!
ok
{
continue
// not tracked
}
...
...
@@ -564,6 +565,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
rt
.
files
.
Del
(
foid
)
if
len
(
rt
.
files
)
==
0
{
delete
(
δFtail
.
byRoot
,
δ
.
blktabOld
)
// XXX reset Zinroot -= δ.blktabNew
}
}
}
...
...
@@ -573,6 +575,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) (_ ΔF, err error) {
rt
=
&
_RootTrack
{
files
:
setOid
{},
Zinblk
:
map
[
zodb
.
Oid
]
setI64
{},
// XXX reset Zinroot -= δ.blktabNew
}
δFtail
.
byRoot
[
δ
.
blktabNew
]
=
rt
}
...
...
wcfs/internal/zdata/δftail_test.go
View file @
47e0730a
...
...
@@ -445,31 +445,11 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
retrackAll
()
}
// verify byRoot, Zinroot
trackZinroot
:=
map
[
string
]
setOid
{}
// verify byRoot
trackRfiles
:=
map
[
zodb
.
Oid
]
setOid
{}
for
root
,
rt
:=
range
δFtail
.
byRoot
{
trackRfiles
[
root
]
=
rt
.
files
for
zoid
:=
range
rt
.
Zinblk
{
zblki
:=
commit
.
ZBlkTab
[
zoid
]
inroot
,
ok
:=
trackZinroot
[
zblki
.
Name
]
if
!
ok
{
inroot
=
setOid
{}
trackZinroot
[
zblki
.
Name
]
=
inroot
}
inroot
.
Add
(
root
)
}
}
Zinroot
:=
map
[
string
]
setOid
{}
for
zblk
:=
range
Zinblk
{
inroot
:=
setOid
{};
inroot
.
Add
(
t
.
Root
())
Zinroot
[
zblk
]
=
inroot
}
if
!
reflect
.
DeepEqual
(
trackZinroot
,
Zinroot
)
{
t
.
Errorf
(
"Zinroot:
\n
have: %v
\n
want: %v"
,
trackZinroot
,
Zinroot
)
}
filesOK
:=
setOid
{}
if
!
delfile
{
filesOK
.
Add
(
foid
)
...
...
@@ -479,7 +459,22 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
RfilesOK
[
t
.
Root
()]
=
filesOK
}
if
!
reflect
.
DeepEqual
(
trackRfiles
,
RfilesOK
)
{
t
.
Errorf
(
"Rfiles:
\n
have: %v
\n
want: %v"
,
trackRfiles
,
RfilesOK
)
t
.
Errorf
(
"Rfiles:
\n
have: %v
\n
want: %v"
,
trackRfiles
,
RfilesOK
)
}
// verify Zinroot
trackZinroot
:=
map
[
string
]
setOid
{}
for
zoid
,
inroot
:=
range
δFtail
.
zinroot
{
zblki
:=
commit
.
ZBlkTab
[
zoid
]
trackZinroot
[
zblki
.
Name
]
=
inroot
.
Clone
()
// XXX clone needed?
}
Zinroot
:=
map
[
string
]
setOid
{}
for
zblk
:=
range
Zinblk
{
inroot
:=
setOid
{};
inroot
.
Add
(
t
.
Root
())
Zinroot
[
zblk
]
=
inroot
}
if
!
reflect
.
DeepEqual
(
trackZinroot
,
Zinroot
)
{
t
.
Errorf
(
"Zinroot:
\n
have: %v
\n
want: %v"
,
trackZinroot
,
Zinroot
)
}
// verify Zinblk
...
...
@@ -503,7 +498,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
t
.
Errorf
(
"len(.byRoot) != (0,1) ; byRoot: %v"
,
δFtail
.
byRoot
)
}
if
!
reflect
.
DeepEqual
(
trackZinblk
,
Zinblk
)
{
t
.
Errorf
(
"Zinblk:
\n
have: %v
\n
want: %v"
,
trackZinblk
,
Zinblk
)
t
.
Errorf
(
"Zinblk:
\n
have: %v
\n
want: %v"
,
trackZinblk
,
Zinblk
)
}
// ForgetPast configured threshold
...
...
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