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
d4848186
Commit
d4848186
authored
May 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1a0cfd54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
22 deletions
+12
-22
wcfs/pptreesubset.go
wcfs/pptreesubset.go
+12
-22
No files found.
wcfs/pptreesubset.go
View file @
d4848186
...
...
@@ -44,9 +44,7 @@ const debugPPSet = false
// Nodes can be added into the set via AddPath. Path is reverse operation - it
// returns path to tree node given node oid.
//
// XXX ΔPPTreeSubSet
//
// Every node in the set also has .parent pointer. XXX
// Every node in the set comes with .parent pointer.
type
PPTreeSubSet
map
[
zodb
.
Oid
]
*
nodeInTree
// nodeInTree represents tracking information about a node.
...
...
@@ -57,7 +55,7 @@ type nodeInTree struct {
}
// Path returns path leading to node specified by oid.
// Path returns path leading to
the
node specified by oid.
//
// The node must be in the set.
func
(
S
PPTreeSubSet
)
Path
(
oid
zodb
.
Oid
)
(
path
[]
zodb
.
Oid
)
{
...
...
@@ -96,37 +94,29 @@ func (S PPTreeSubSet) AddPath(path []zodb.Oid) {
}
parent
:=
zodb
.
InvalidOid
var
ptrack
*
nodeInTree
=
nil
var
track
*
nodeInTree
// XXX kill here
var
oldTrack
bool
var
pt
*
nodeInTree
=
nil
for
_
,
oid
:=
range
path
{
if
oid
==
zodb
.
InvalidOid
{
panicf
(
"path has node with invalid oid: %v"
,
path
)
}
track
,
oldTrack
=
S
[
oid
]
if
!
oldTrack
{
track
=
&
nodeInTree
{
parent
:
parent
,
nchild
:
0
}
// XXX
/*
if i == l-1 { // leaf
track.holes = SetKey{}
}
*/
S
[
oid
]
=
track
// XXX .trackNew += oid
t
,
already
:=
S
[
oid
]
if
!
already
{
t
=
&
nodeInTree
{
parent
:
parent
,
nchild
:
0
}
S
[
oid
]
=
t
}
if
t
rack
.
parent
!=
parent
{
if
t
.
parent
!=
parent
{
// XXX -> error (e.g. due to corrupt data in ZODB) ?
panicf
(
"node %s is reachable from multiple parents: %s %s"
,
oid
,
t
rack
.
parent
,
parent
)
oid
,
t
.
parent
,
parent
)
}
if
pt
rack
!=
nil
&&
!
oldTrack
{
pt
rack
.
nchild
++
if
pt
!=
nil
&&
!
already
{
pt
.
nchild
++
}
parent
=
oid
pt
rack
=
track
pt
=
t
}
}
...
...
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