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
eb715051
Commit
eb715051
authored
May 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
73501d87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
100 deletions
+5
-100
wcfs/δbtail.go
wcfs/δbtail.go
+5
-100
No files found.
wcfs/δbtail.go
View file @
eb715051
...
...
@@ -282,12 +282,6 @@ type nodeTrack struct {
//
// XXX place
type
δtrackIndex
struct
{
/*
// set of leaf nodes to remove. After leafs are removed, their parents
// are automatically cleaned down-up. Removals are processed before
// adds (see below).
DelLeaf SetOid
*/
Del
trackIndex
Add
trackIndex
δnchildNonLeafs
map
[
zodb
.
Oid
]
int
...
...
@@ -397,42 +391,20 @@ func (A trackIndex) DifferenceInplace(B trackIndex) {
B
.
verify
()
defer
A
.
verify
()
// δnchild := map[zodb.Oid]int{}
A
.
xDifferenceInplace
(
B
)
// A.fixup(δnchild)
}
//func (A trackIndex) xDifferenceInplace(B trackIndex, δnchild map[zodb.Oid]int) {
func
(
A
trackIndex
)
xDifferenceInplace
(
B
trackIndex
)
{
if
debugPPSet
{
fmt
.
Printf
(
"
\n\n
xDifferenceInplace:
\n
"
)
fmt
.
Printf
(
" a: %s
\n
"
,
A
)
fmt
.
Printf
(
" b: %s
\n
"
,
B
)
// fmt.Printf(" δ: %v\n", δnchild)
defer
func
()
{
fmt
.
Printf
(
" ->d: %s
\n
"
,
A
)
// fmt.Printf(" ->δ: %v\n", δnchild)
}()
defer
fmt
.
Printf
(
" ->d: %s
\n
"
,
A
)
}
δnchild
:=
map
[
zodb
.
Oid
]
int
{}
/* XXX kill
// remove (A^B).leafs and thier parents
// we have to start (A^B).leafs - not from B.leafs - because B can
// contain non-leaf to remove from A, with that non-leaf having
// children in B, that are not present in A:
//
// c c
// | |
// 11 11
// | |
// 14 14
// | \
// 15 16
AB := B.Intersect(A)
*/
// remove B.leafs and thier parents
// remove B.leafs and their parents
for
oid
,
t2
:=
range
B
{
if
t2
.
nchild
!=
0
{
continue
// not a leaf
...
...
@@ -453,7 +425,6 @@ func (A trackIndex) xDifferenceInplace(B trackIndex) {
}
delete
(
A
,
oid
)
// XXX + return A.nchild in removedNonLeafs {} oid -> nchild ? (probably no)
if
t
.
parent
!=
zodb
.
InvalidOid
{
δnchild
[
t
.
parent
]
-=
1
}
...
...
@@ -462,17 +433,12 @@ func (A trackIndex) xDifferenceInplace(B trackIndex) {
A
.
fixup
(
δnchild
)
}
//func (A trackIndex) xUnionInplace(B trackIndex, δnchild map[zodb.Oid]int) {
func
(
A
trackIndex
)
xUnionInplace
(
B
trackIndex
)
{
if
debugPPSet
{
fmt
.
Printf
(
"
\n\n
xUnionInplace:
\n
"
)
fmt
.
Printf
(
" a: %s
\n
"
,
A
)
fmt
.
Printf
(
" b: %s
\n
"
,
B
)
// fmt.Printf(" δ: %v\n", δnchild)
defer
func
()
{
fmt
.
Printf
(
" ->u: %s
\n
"
,
A
)
// fmt.Printf(" ->δ: %v\n", δnchild)
}()
defer
fmt
.
Printf
(
" ->u: %s
\n
"
,
A
)
}
δnchild
:=
map
[
zodb
.
Oid
]
int
{}
...
...
@@ -482,7 +448,7 @@ func (A trackIndex) xUnionInplace(B trackIndex) {
if
!
already
{
t
=
&
nodeTrack
{
parent
:
t2
.
parent
,
nchild
:
0
}
A
[
oid
]
=
t
// remeber to nchild++ in parent
// reme
m
ber to nchild++ in parent
if
t
.
parent
!=
zodb
.
InvalidOid
{
δnchild
[
t
.
parent
]
+=
1
}
...
...
@@ -537,35 +503,7 @@ func (A trackIndex) UnionInplace(B trackIndex) {
B
.
verify
()
defer
A
.
verify
()
// δnchild := map[zodb.Oid]int{}
A
.
xUnionInplace
(
B
)
// A.fixup(δnchild)
/*
for oid, t2 := range B {
t, already := A[oid]
if !already {
t = &nodeTrack{parent: t2.parent, nchild: t2.nchild}
A[oid] = t
} else {
if t2.parent != t.parent {
// XXX or verify this at Track time and require
// that update is passed only entries with the
// same .parent? (then it would be ok to panic here)
// XXX -> error (e.g. due to corrupt data in ZODB)
panicf("node %s is reachable from multiple parents: %s %s",
oid, t.parent, t2.parent)
}
t.nchild += t2.nchild
if t.parent != zodb.InvalidOid {
// this node is already present in both trees
// compensate for that in its parent (which must be present)
A[t.parent].nchild--
}
}
}
*/
}
// ApplyΔ applies δ to trackIdx. XXX
...
...
@@ -756,7 +694,7 @@ func (δBtail *ΔBtail) holeIdxFor(root zodb.Oid) treeSetKey {
return
holeIdx
}
// Path returns path leading to node spe
fic
ied by oid.
// Path returns path leading to node spe
cif
ied by oid.
//
// The node must be in the set.
// XXX place
...
...
@@ -1329,20 +1267,10 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
}
// adjust trackIdx by merge(δtrackTops)
/*
δtrack := &δtrackIndex{DelLeaf: SetOid{}, Add: trackIndex{}}
for _, δ := range δtrackv {
δtrack.DelLeaf.Update(δ.DelLeaf)
for oid, t := range δ.Add {
δtrack.Add[oid] = t // XXX verify changes from 2 δtrackTops are consistent
}
}
*/
δtrack
=
&
δtrackIndex
{
Del
:
trackIndex
{},
Add
:
trackIndex
{},
δnchildNonLeafs
:
map
[
zodb
.
Oid
]
int
{}}
for
_
,
δ
:=
range
δtrackv
{
δtrack
.
Update
(
δ
)
}
// trackIdx.ApplyΔ(δtrack)
return
δT
,
δtrack
,
nil
}
...
...
@@ -1416,7 +1344,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
if
B
==
nil
{
panic
(
"B is nil"
)
}
δ
=
map
[
Key
]
ΔValue
{}
// δtrack = &δtrackIndex{DelLeaf: SetOid{}, Add: trackIndex{}}
δtrack
=
&
δtrackIndex
{
Del
:
trackIndex
{},
Add
:
trackIndex
{},
δnchildNonLeafs
:
map
[
zodb
.
Oid
]
int
{}}
defer
tracef
(
" -> δ: %v
\n
"
,
δ
)
...
...
@@ -1454,10 +1381,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
}
// {} oid -> parent for all nodes in Bv: current and previously expanded - up till top B
// XXX
// XXX requires A.oid == B.oid
// XXX -> trackIndex
// BtrackIdx := map[zodb.Oid]nodeTrack{B.POid(): nodeTrack{parent: trackIdx[B.POid()].parent}}
BtrackIdx
:=
trackIndex
{}
BtrackIdx
.
AddPath
(
trackIdx
.
Path
(
B
.
POid
()))
...
...
@@ -1482,7 +1406,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
// a is bucket -> δ-
δA
,
err
:=
diffB
(
ctx
,
a
,
nil
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
err
}
err
=
δMerge
(
δ
,
δA
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
err
}
// δtrack.DelLeaf.Add(a.POid())
δtrack
.
Del
.
AddPath
(
ra
.
Path
())
// Bkqueue <- δA
...
...
@@ -1540,7 +1463,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
bchildren
:=
Bv
.
Expand
(
blo
)
for
_
,
bc
:=
range
bchildren
{
bcOid
:=
bc
.
node
.
POid
()
// BtrackIdx[bcOid] = nodeTrack{parent: blo.node.POid()}
BtrackIdx
.
AddPath
(
bc
.
Path
())
if
acOid
==
bcOid
{
found
=
true
...
...
@@ -1566,22 +1488,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
}
}
/* XXX kill
oid := acOid
for oid != zodb.InvalidOid {
told := trackIdx[oid]
tnew, ok := BtrackIdx[oid]
if !ok {
break
}
if told == nil || (told.parent != tnew.parent) {
δtrack.Add.AddPath(BtrackIdx.Path(oid))
}
oid = tnew.parent
}
*/
continue
}
}
...
...
@@ -1665,7 +1571,6 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
// δ <- δA
err
=
δMerge
(
δ
,
δA
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
err
}
// δtrack.DelLeaf.Add(a.node.POid())
δtrack
.
Del
.
AddPath
(
a
.
Path
())
// Bkqueue <- δA
...
...
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