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
db2d5e41
Commit
db2d5e41
authored
Jun 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
78ca2fad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
+36
-2
wcfs/internal/xbtree/pptreesubset.go
wcfs/internal/xbtree/pptreesubset.go
+27
-0
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+9
-2
No files found.
wcfs/internal/xbtree/pptreesubset.go
View file @
db2d5e41
...
...
@@ -89,6 +89,8 @@ func (S PPTreeSubSet) Path(oid zodb.Oid) (path []zodb.Oid) {
}
// AddPath adds path to a node to the set.
//
// Note: embedded buckets (leaf node with InvalidOid) are removed from the path.
func
(
S
PPTreeSubSet
)
AddPath
(
path
[]
zodb
.
Oid
)
{
S
.
verify
()
defer
S
.
verify
()
...
...
@@ -98,6 +100,8 @@ func (S PPTreeSubSet) AddPath(path []zodb.Oid) {
panic
(
"empty path"
)
}
path
=
normPath
(
path
)
/*
// don't keep track of artificial empty tree
if l == 1 && path[0] == zodb.InvalidOid {
return
...
...
@@ -109,6 +113,7 @@ func (S PPTreeSubSet) AddPath(path []zodb.Oid) {
if l == 2 && path[1] == zodb.InvalidOid {
path = path[:1]
}
*/
parent
:=
zodb
.
InvalidOid
var
pt
*
nodeInTree
=
nil
...
...
@@ -137,6 +142,28 @@ func (S PPTreeSubSet) AddPath(path []zodb.Oid) {
}
}
// normPath normalizes path.
//
// It removes embedded buckets and artificial empty trees.
// Returned slice is subslice of path and aliases its memory.
func
normPath
(
path
[]
zodb
.
Oid
)
[]
zodb
.
Oid
{
l
:=
len
(
path
)
// don't keep track of artificial empty tree
if
l
==
1
&&
path
[
0
]
==
zodb
.
InvalidOid
{
return
nil
}
// don't explicitly keep track of embedded buckets - they all have
// InvalidOid, and thus, if kept in S, e.g. T/B1:a and another
// T/B2:b would lead to InvalidOid having multiple parents.
if
l
==
2
&&
path
[
1
]
==
zodb
.
InvalidOid
{
return
path
[
:
1
]
}
return
path
}
// ---- Union/Difference/Intersetctior ----
// Union returns U = PP(A.leafs | B.leafs)
...
...
wcfs/internal/xbtree/δbtail.go
View file @
db2d5e41
...
...
@@ -249,9 +249,16 @@ func (δBtail *ΔBtail) Track(key Key, nodePath []Node) error { // XXX Tree|Buck
func
(
δBtail
*
ΔBtail
)
track
(
key
Key
,
path
[]
zodb
.
Oid
)
error
{
// XXX locking
root
:=
path
[
0
]
// first normalize path: remove embedded bucket and check if it was an
// empty artificial tree. We need to do the normalization becase we
// later check whether leaf path[-1] ∈ trackSet and without
// normalization path[-1] can be InvalidOid.
path
=
normPath
(
path
)
if
len
(
path
)
==
0
{
return
nil
// empty tree
}
// XXX first normalize path
root
:=
path
[
0
]
// nothing to do if key is already tracked
leaf
:=
path
[
len
(
path
)
-
1
]
...
...
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