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
f41b7f88
Commit
f41b7f88
authored
Jul 16, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
70c8c3e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
7 deletions
+126
-7
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+126
-7
No files found.
wcfs/internal/zdata/δftail.go
View file @
f41b7f88
...
@@ -101,6 +101,9 @@ type _ΔFileEpoch struct {
...
@@ -101,6 +101,9 @@ type _ΔFileEpoch struct {
newRoot
zodb
.
Oid
// .blktab was changed to point to newRoot ; ----//----
newRoot
zodb
.
Oid
// .blktab was changed to point to newRoot ; ----//----
newBlkSize
int64
// .blksize was changed to newBlkSize ; -1 if ZBigFile deleted
newBlkSize
int64
// .blksize was changed to newBlkSize ; -1 if ZBigFile deleted
// XXX +oldBlkSize ?
// XXX +oldBlkSize ?
// snapshot of trackSetZBlk for this file right before this epoch
oldTrackSetZBlk
map
[
zodb
.
Oid
]
setI64
// {} zblk -> {}blk
}
}
// zblkTrack keeps information in which root/blocks ZBlk is present as of @head.
// zblkTrack keeps information in which root/blocks ZBlk is present as of @head.
...
@@ -452,17 +455,132 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
...
@@ -452,17 +455,132 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
δftail
:=
δFtail
.
byFile
[
zfile
.
POid
()]
δftail
:=
δFtail
.
byFile
[
zfile
.
POid
()]
vδE
:=
δftail
.
vδE
ie
:=
len
(
vδE
)
-
1
_
=
ie
vδZ
:=
δFtail
.
δBtail
.
ΔZtail
()
.
SliceByRev
(
lo
,
hi
)
vδZ
:=
δFtail
.
δBtail
.
ΔZtail
()
.
SliceByRev
(
lo
,
hi
)
iz
:=
len
(
vδZ
)
-
1
iz
:=
len
(
vδZ
)
-
1
root
:=
δftail
.
root
// XXX take epochs into account
// find epoch that covers hi
vδT
:=
δFtail
.
δBtail
.
SliceByRootRev
(
root
,
lo
,
δFtail
.
Head
())
// NOTE @head, not hi
vδE
:=
δftail
.
vδE
le
:=
len
(
vδE
)
ie
:=
sort
.
Search
(
le
,
func
(
i
int
)
bool
{
return
hi
<
vδE
[
i
]
.
Rev
})
// vδE[ie] is next epoch
// vδE[ie-1] is epoch that covers hi
// loop through all epochs till lo
for
lastEpoch
:=
false
;
!
lastEpoch
;
{
// current epoch
var
epoch
zodb
.
Tid
ie
--
if
ie
<
0
{
epoch
=
δFtail
.
Tail
()
}
else
{
epoch
=
vδE
[
ie
]
.
Rev
}
if
epoch
<=
lo
{
epoch
=
lo
lastEpoch
=
true
}
var
root
zodb
.
Oid
// root of blktab in current epoch
var
head
zodb
.
Tid
// head] of current epoch coverage
// state of Zinblk as we are scanning ← current epoch
// initially corresponds to head of the epoch (= @head for latest epoch)
Zinblk
:=
map
[
zodb
.
Oid
]
setI64
{}
// zblk -> which #blk refers to it
var
ZinblkAt
zodb
.
Tid
// Zinblk covers [ZinblkAt,<next δT>)
if
ie
+
1
==
le
{
// head
root
=
δftail
.
root
head
=
δFtail
.
Head
()
for
zblk
,
zt
:=
range
δFtail
.
trackSetZBlk
{
inblk
,
ok
:=
zt
.
inroot
[
root
]
if
ok
{
Zinblk
[
zblk
]
=
inblk
.
Clone
()
}
}
// XXX ZinblkAt
}
else
{
δE
:=
vδE
[
ie
+
1
]
root
=
δE
.
oldRoot
head
=
δE
.
Rev
-
1
// XXX ok?
for
zblk
,
inblk
:=
range
δE
.
oldTrackSetZBlk
{
Zinblk
[
zblk
]
=
inblk
.
Clone
()
}
}
// vδT for current epoch
vδT
:=
δFtail
.
δBtail
.
SliceByRootRev
(
root
,
epoch
,
head
)
// NOTE @head, not hi
it
:=
len
(
vδT
)
-
1
if
it
>=
0
{
ZinblkAt
=
vδT
[
it
]
.
Rev
}
else
{
ZinblkAt
=
epoch
}
// merge current vδZ and vδT
for
((
iz
>=
0
&&
vδZ
[
iz
]
.
Rev
>=
epoch
)
||
it
>=
0
)
{
// δZ that is covered by current Zinblk
// -> update δf
if
iz
>=
0
{
δZ
:=
vδZ
[
iz
]
if
ZinblkAt
<=
δZ
.
Rev
{
//fmt.Printf("δZ @%s\n", δZ.Rev)
for
_
,
oid
:=
range
δZ
.
Changev
{
inblk
,
ok
:=
Zinblk
[
oid
]
if
ok
&&
len
(
inblk
)
!=
0
{
δf
:=
vδfTail
(
δZ
.
Rev
)
δf
.
Blocks
.
Update
(
inblk
)
}
}
iz
--
continue
}
}
// δT -> adjust Zinblk + update δf
if
it
>=
0
{
δT
:=
vδT
[
it
]
//fmt.Printf("δT @%s\n", δT.Rev)
for
blk
,
δzblk
:=
range
δT
.
ΔKV
{
// apply in reverse as we go ←
if
δzblk
.
New
!=
xbtree
.
VDEL
{
inblk
,
ok
:=
Zinblk
[
δzblk
.
New
]
if
ok
{
inblk
.
Del
(
blk
)
}
}
if
δzblk
.
Old
!=
xbtree
.
VDEL
{
inblk
,
ok
:=
Zinblk
[
δzblk
.
Old
]
if
!
ok
{
inblk
=
setI64
{}
Zinblk
[
δzblk
.
Old
]
=
inblk
}
inblk
.
Add
(
blk
)
}
if
δT
.
Rev
<=
hi
{
δf
:=
vδfTail
(
δT
.
Rev
)
δf
.
Blocks
.
Add
(
blk
)
δf
.
Size
=
true
// see Update
}
}
it
--
if
it
>=
0
{
ZinblkAt
=
vδT
[
it
]
.
Rev
}
else
{
ZinblkAt
=
epoch
}
}
}
}
/*
// state of Zinblk as we are scanning ←
// state of Zinblk as we are scanning ←
// initially corresponds to @head = vδT[-1]
// initially corresponds to @head = vδT[-1]
Zinblk := map[zodb.Oid]setI64{} // zblk -> which #blk refers to it
Zinblk := map[zodb.Oid]setI64{} // zblk -> which #blk refers to it
...
@@ -480,7 +598,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
...
@@ -480,7 +598,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
ZinblkAt = lo
ZinblkAt = lo
}
}
for
(
iz
>=
0
||
it
>=
0
)
{
// XXX + ie
for (iz >= 0 || it >= 0) {
// δZ that is covered by current Zinblk
// δZ that is covered by current Zinblk
// -> update δf
// -> update δf
if iz >= 0 {
if iz >= 0 {
...
@@ -535,6 +653,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
...
@@ -535,6 +653,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
}
}
}
}
}
}
*/
// vδf was built in reverse order
// vδf was built in reverse order
...
...
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