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
8178a687
Commit
8178a687
authored
Aug 04, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
597329f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
4 deletions
+36
-4
wcfs/δbtail.go
wcfs/δbtail.go
+36
-4
No files found.
wcfs/δbtail.go
View file @
8178a687
...
...
@@ -716,6 +716,11 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
Akdone
:=
SetKey
{}
// already processed keys in A
Bkdone
:=
SetKey
{}
// ----//---- in B
// {} oid -> parent for all nodes in Bv: current and previously expanded - up till top B
// XXX
// XXX requires A.oid == B.oid
BtrackIdx
:=
map
[
zodb
.
Oid
]
nodeTrack
{
B
.
POid
()
:
nodeTrack
{
parent
:
trackIdx
[
B
.
POid
()]
.
parent
}}
// phase 1: expand A top->down driven by δZTC.
// by default a node contributes to δ-
// a node ac does not contribute to δ- and can be skipped, if:
...
...
@@ -743,7 +748,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
case
*
Tree
:
// a is tree - expand it and queue children
//
see
for each children whether it can be skipped
//
check
for each children whether it can be skipped
// XXX if a is ø tree
achildren
:=
Av
.
Expand
(
ra
)
for
_
,
ac
:=
range
achildren
{
...
...
@@ -755,9 +760,36 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
}
if
!
δZTC
.
Has
(
acOid
)
{
// XXX also check b's parents, as they could be already expanded?
bc
,
ok
,
err
:=
Bv
.
tryGetToNode
(
acOid
,
ac
.
lo
,
ac
.
hi_
,
/*maxdepth*/
2
)
if
err
!=
nil
{
return
nil
,
err
}
// check B children for node with ac.oid
// while checking expand Bv till ac.lo and ac.hi_ point to the same node
// ( this does not give exact answer but should be a reasonable heuristic;
// the diff is the same if heuristic does not work and we
// look into and load more nodes to compute δ )
_
,
ok
:=
BtrackIdx
[
acOid
]
if
!
ok
{
for
{
blo
:=
Bv
.
Get
(
ac
.
lo
)
bhi_
:=
Bv
.
Get
(
ac
.
hi_
)
if
blo
!=
bhi_
{
break
}
err
=
blo
.
node
.
PActivate
(
ctx
);
/*X*/
if
err
!=
nil
{
return
nil
,
err
}
defer
blo
.
node
.
PDeactivate
()
bchildren
:=
Bv
.
Expand
(
blo
)
found
:=
false
for
_
,
bc
:=
range
bchildren
{
bcOid
:=
bc
.
node
.
POid
()
BtrackIdx
[
bcOid
]
=
nodeTrack
{
parent
:
blo
.
node
.
POid
()}
if
acOid
==
bcOid
{
found
=
true
}
}
if
found
{
break
}
}
}
if
ok
{
// ac can be skipped
// XXX Bkqueue <- holes(ac.range \ bc.range)
...
...
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