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
1ae40c93
Commit
1ae40c93
authored
May 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e7c831f2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
wcfs/δbtail.go
wcfs/δbtail.go
+17
-13
No files found.
wcfs/δbtail.go
View file @
1ae40c93
...
...
@@ -896,12 +896,14 @@ func (δBtail *ΔBtail) rebuild() (err error) {
for
root
,
δtops
:=
range
δtopsByRoot
{
holeIdx
:=
treeSetKey
{
SetKey
{}}
// XXX stub
// diff backwards curr -> prev
δT
,
err
:=
treediff
(
ctx
,
root
,
δtops
,
δZTC
,
trackNew
,
holeIdx
,
zconnCurr
,
zconnPrev
)
δT
,
δtrack
,
err
:=
treediff
(
ctx
,
root
,
δtops
,
δZTC
,
trackNew
,
holeIdx
,
zconnCurr
,
zconnPrev
)
if
err
!=
nil
{
return
err
}
tracef
(
"-> root<%s> δkv*: %v
\n
"
,
root
,
δT
)
tracef
(
"-> root<%s> δkv*: %v δtrack*: %v
\n
"
,
root
,
δT
,
δtrack
)
trackNew
.
ApplyΔ
(
δtrack
)
if
len
(
δT
)
==
0
{
// an object might be resaved without change
continue
...
...
@@ -1002,12 +1004,12 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
for
root
,
δtops
:=
range
δtopsByRoot
{
holeIdx
:=
δBtail
.
holeIdxByRoot
[
root
]
δT
,
err
:=
treediff
(
ctx
,
root
,
δtops
,
δZTC
,
δBtail
.
trackIdx
,
holeIdx
,
zconnOld
,
zconnNew
)
δT
,
δtrack
,
err
:=
treediff
(
ctx
,
root
,
δtops
,
δZTC
,
δBtail
.
trackIdx
,
holeIdx
,
zconnOld
,
zconnNew
)
if
err
!=
nil
{
return
ΔB
{},
err
}
tracef
(
"
\n
-> root<%s> δkv: %v
\n
"
,
root
,
δT
)
tracef
(
"
\n
-> root<%s> δkv: %v
δtrack: %v
\n
"
,
root
,
δT
,
δtrack
)
if
len
(
δT
)
>
0
{
// an object might be resaved without change
δB
.
ByRoot
[
root
]
=
δT
...
...
@@ -1033,6 +1035,8 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
// XXX rebuild KVAtTail
// XXX rebuild lastRevOf
}
δBtail
.
trackIdx
.
ApplyΔ
(
δtrack
)
}
return
δB
,
nil
...
...
@@ -1267,15 +1271,15 @@ func (rs rangeSplit) String() string {
// treediff computes δT
for tree
specified by root in between old..new.
// treediff computes δT
/δtrack for tree/trackIdx
specified by root in between old..new.
//
// δtops is set of top nodes for changed subtrees.
// δZTC is connected(δZ/T) - connected closure for subset of δZ(old..new) that
// touches tracked nodes of T.
//
// XXX
trackIdx is updated
// XXX
holeIdx is updated
func
treediff
(
ctx
context
.
Context
,
root
zodb
.
Oid
,
δtops
SetOid
,
δZTC
SetOid
,
trackIdx
trackIndex
,
holeIdx
treeSetKey
,
zconnOld
,
zconnNew
*
zodb
.
Connection
)
(
δT
map
[
Key
]
ΔValue
,
err
error
)
{
// XXX
holeIdx is updated XXX -> return similarly to δtrack
// XXX
^^^ -> but better kill holeIdx and do everything only via trackIdx
func
treediff
(
ctx
context
.
Context
,
root
zodb
.
Oid
,
δtops
SetOid
,
δZTC
SetOid
,
trackIdx
trackIndex
,
holeIdx
treeSetKey
,
zconnOld
,
zconnNew
*
zodb
.
Connection
)
(
δT
map
[
Key
]
ΔValue
,
δtrack
*
δtrackIndex
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"treediff %s..%s %s"
,
zconnOld
.
At
(),
zconnNew
.
At
(),
root
)
tracef
(
"
\n
treediff %s δtops: %v δZTC: %v
\n
"
,
root
,
δtops
,
δZTC
)
...
...
@@ -1289,12 +1293,12 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
b
,
err2
:=
zgetNode
(
ctx
,
zconnNew
,
top
)
err
:=
xerr
.
Merge
(
err1
,
err2
)
if
err
!=
nil
{
return
nil
,
err
return
nil
,
nil
,
err
}
δtop
,
δtrackTop
,
err
:=
diffX
(
ctx
,
a
,
b
,
δZTC
,
trackIdx
,
holeIdx
)
if
err
!=
nil
{
return
nil
,
err
return
nil
,
nil
,
err
}
// FIXME -> merge (VDEL vs add)
...
...
@@ -1331,13 +1335,13 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
}
}
*/
δtrack
:
=
&
δtrackIndex
{
Del
:
trackIndex
{},
Add
:
trackIndex
{},
δnchildNonLeafs
:
map
[
zodb
.
Oid
]
int
{}}
δtrack
=
&
δtrackIndex
{
Del
:
trackIndex
{},
Add
:
trackIndex
{},
δnchildNonLeafs
:
map
[
zodb
.
Oid
]
int
{}}
for
_
,
δ
:=
range
δtrackv
{
δtrack
.
Update
(
δ
)
}
trackIdx
.
ApplyΔ
(
δtrack
)
//
trackIdx.ApplyΔ(δtrack)
return
δT
,
nil
return
δT
,
δtrack
,
nil
}
// diffX computes difference in between two revisions of a tree's subtree.
...
...
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