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
af2ca266
Commit
af2ca266
authored
Jul 09, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e7b598c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
2 deletions
+105
-2
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+105
-2
No files found.
wcfs/internal/zdata/δftail.go
View file @
af2ca266
...
@@ -96,7 +96,7 @@ type ΔFtail struct {
...
@@ -96,7 +96,7 @@ type ΔFtail struct {
// 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.
type
zblkTrack
struct
{
type
zblkTrack
struct
{
inroot
map
[
zodb
.
Oid
]
setI64
// {} root -> {}blk
XXX later switch to this
inroot
map
[
zodb
.
Oid
]
setI64
// {} root -> {}blk
}
}
// ΔF represents a change in files space.
// ΔF represents a change in files space.
...
@@ -395,6 +395,8 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
...
@@ -395,6 +395,8 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
func
(
δFtail
*
ΔFtail
)
SliceByFileRev
(
zfile
*
ZBigFile
,
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
*
ΔFile
{
func
(
δFtail
*
ΔFtail
)
SliceByFileRev
(
zfile
*
ZBigFile
,
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
*
ΔFile
{
xtail
.
AssertSlice
(
δFtail
,
lo
,
hi
)
xtail
.
AssertSlice
(
δFtail
,
lo
,
hi
)
// XXX locking
// query .δBtail.SliceByRootRev(file.blktab, lo, hi) +
// query .δBtail.SliceByRootRev(file.blktab, lo, hi) +
// merge δZBlk history with that.
// merge δZBlk history with that.
...
@@ -412,10 +414,110 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
...
@@ -412,10 +414,110 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
// δFile ────────o───────o──────x─────x────────────────────────
// δFile ────────o───────o──────x─────x────────────────────────
vδT
:=
δFtail
.
δBtail
.
SliceByRootRev
(
zfile
.
blktab
,
lo
,
hi
)
// XXX needs activate zfile
// vδT := δFtail.δBtail.SliceByRootRev(zfile.blktab, lo, hi) // XXX needs activate zfile
// XXX needs activate zfile
root
:=
zfile
.
blktab
.
POid
()
vδT
:=
δFtail
.
δBtail
.
SliceByRootRev
(
root
,
lo
,
δFtail
.
Head
())
// NOTE @head, not hi
vδZ
:=
δFtail
.
δBtail
.
ΔZtail
()
.
SliceByRev
(
lo
,
hi
)
vδZ
:=
δFtail
.
δBtail
.
ΔZtail
()
.
SliceByRev
(
lo
,
hi
)
var
vδf
[]
*
ΔFile
var
vδf
[]
*
ΔFile
// vδfTail returns or creates vδf entry for revision tail
// tail must be <= all vδf revisions
vδfTail
:=
func
(
tail
zodb
.
Tid
)
*
ΔFile
{
if
l
:=
len
(
vδf
);
l
>
0
{
δfTail
:=
vδf
[
l
-
1
]
if
δfTail
.
Rev
==
tail
{
return
δfTail
}
if
!
(
tail
<=
δfTail
.
Rev
)
{
panic
(
"tail not ↓"
)
}
}
δfTail
:=
&
ΔFile
{
Rev
:
tail
,
Blocks
:
setI64
{}}
vδf
=
append
(
vδf
,
δfTail
)
return
δfTail
}
// state of Zinblk as we are scanning ←
// initially corresponds to @head = vδT[-1]
Zinblk
:=
map
[
zodb
.
Oid
]
setI64
{}
// zblk -> which #blk refer to it
var
ZinblkAt
zodb
.
Tid
// Zinblk covers [ZinblkAt,<next δT>)
for
zblk
,
zt
:=
range
δFtail
.
trackSetZBlk
{
inblk
,
ok
:=
zt
.
inroot
[
root
]
if
ok
{
Zinblk
[
zblk
]
=
inblk
.
Clone
()
}
}
it
:=
len
(
vδT
)
-
1
if
it
>=
0
{
ZinblkAt
=
vδT
[
it
]
.
Rev
}
else
{
ZinblkAt
=
lo
}
// it--
iz
:=
len
(
vδZ
)
-
1
for
(
iz
>=
0
||
it
>=
0
)
{
// δZ that is covered by current Zinblk
// -> update δf
if
iz
>=
0
{
δZ
:=
vδZ
[
iz
]
if
ZinblkAt
<=
δZ
.
Rev
{
for
_
,
oid
:=
range
δZ
.
Changev
{
inblk
,
ok
:=
Zinblk
[
oid
]
if
ok
{
δf
:=
vδfTail
(
δZ
.
Rev
)
δf
.
Blocks
.
Update
(
inblk
)
}
}
iz
--
continue
}
}
// δT -> adjust Zinblk + update δf
if
it
>=
0
{
δT
:=
vδT
[
it
]
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
=
lo
}
}
}
// XXX reverse vδf before return
return
vδf
/*
// state of `{} blk -> zblk` as we are scanning ↓
// state of `{} blk -> zblk` as we are scanning ↓
δblktab := map[int64]struct {
δblktab := map[int64]struct {
zblk zodb.Oid // blk points to this zblk
zblk zodb.Oid // blk points to this zblk
...
@@ -444,6 +546,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
...
@@ -444,6 +546,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
}
}
return vδf
return vδf
*/
/*
/*
...
...
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