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
6df31f29
Commit
6df31f29
authored
May 13, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1a4b5673
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
15 deletions
+38
-15
wcfs/δbtail.go
wcfs/δbtail.go
+38
-15
No files found.
wcfs/δbtail.go
View file @
6df31f29
...
@@ -217,10 +217,18 @@ type ΔTree struct {
...
@@ -217,10 +217,18 @@ type ΔTree struct {
}
}
// XXX is a set of PP(leafs) nodes XXX -> PTreeSubSet ? TreePSubSet ? TreePPSet ? PPSubSet ?
// XXX PPNodeSet? TreePPSubSet ?
//
// where PP maps a leaf to {leaf, leaf.parent, leaf.parent.parent, ...} up to
// top root node from where the leaf is reached.
//
// Every node in the set also has .parent pointer.
//
// XXX place
// XXX place
type
trackIndex
map
[
zodb
.
Oid
]
*
nodeTrack
type
trackIndex
map
[
zodb
.
Oid
]
*
nodeTrack
// XXX place
// XXX place
XXX PTreeSubSetNode ?
// nodeTrack represents tracking information about a node.
// nodeTrack represents tracking information about a node.
type
nodeTrack
struct
{
type
nodeTrack
struct
{
parent
zodb
.
Oid
// parent node | InvalidOid for root
parent
zodb
.
Oid
// parent node | InvalidOid for root
...
@@ -314,20 +322,37 @@ func (tidx trackIndex) verify() {
...
@@ -314,20 +322,37 @@ func (tidx trackIndex) verify() {
}
}
}
}
// Update tidx with trees subsets from tidx2.
// DifferenceInplace sets A = PP(A.leafs \ B.leafs)
func
(
tidx
trackIndex
)
Update
(
tidx2
trackIndex
)
{
//
//fmt.Printf("\n\nUpdate:\n")
// In other words it removes B nodes from A while still maintaining A as P-connected.
//fmt.Printf("tidx: %s\n", tidx)
func
(
A
trackIndex
)
DifferenceInplace
(
B
trackIndex
)
{
//fmt.Printf("tidx2: %s\n", tidx2)
//fmt.Printf("\n\nDifferenceInplace:\n")
//fmt.Printf("A: %s\n", A)
//fmt.Printf("B: %s\n", B)
tidx
.
verify
()
A
.
verify
()
tidx2
.
verify
()
B
.
verify
()
defer
A
.
verify
()
panic
(
"TODO"
)
}
for
oid
,
t2
:=
range
tidx2
{
// UnionInplace sets A = PP(A.leafs | B.leafs)
t
,
already
:=
tidx
[
oid
]
//
// In other words it adds B nodes to A.
func
(
A
trackIndex
)
UnionInplace
(
B
trackIndex
)
{
//fmt.Printf("\n\nUnionInplace:\n")
//fmt.Printf("A: %s\n", A)
//fmt.Printf("B: %s\n", B)
A
.
verify
()
B
.
verify
()
defer
A
.
verify
()
for
oid
,
t2
:=
range
B
{
t
,
already
:=
A
[
oid
]
if
!
already
{
if
!
already
{
t
=
&
nodeTrack
{
parent
:
t2
.
parent
,
nchild
:
t2
.
nchild
}
t
=
&
nodeTrack
{
parent
:
t2
.
parent
,
nchild
:
t2
.
nchild
}
tidx
[
oid
]
=
t
A
[
oid
]
=
t
}
else
{
}
else
{
if
t2
.
parent
!=
t
.
parent
{
if
t2
.
parent
!=
t
.
parent
{
// XXX or verify this at Track time and require
// XXX or verify this at Track time and require
...
@@ -343,12 +368,10 @@ func (tidx trackIndex) Update(tidx2 trackIndex) {
...
@@ -343,12 +368,10 @@ func (tidx trackIndex) Update(tidx2 trackIndex) {
if
t
.
parent
!=
zodb
.
InvalidOid
{
if
t
.
parent
!=
zodb
.
InvalidOid
{
// this node is already present in both trees
// this node is already present in both trees
// compensate for that in its parent (which must be present)
// compensate for that in its parent (which must be present)
tidx
[
t
.
parent
]
.
nchild
--
A
[
t
.
parent
]
.
nchild
--
}
}
}
}
}
}
tidx
.
verify
()
}
}
// ApplyΔ applies δ to trackIdx. XXX
// ApplyΔ applies δ to trackIdx. XXX
...
@@ -743,7 +766,7 @@ func (δBtail *ΔBtail) rebuild() (err error) {
...
@@ -743,7 +766,7 @@ func (δBtail *ΔBtail) rebuild() (err error) {
//
//
// XXX -> teach diffT to return not only δtrack, but also δtrack*
// XXX -> teach diffT to return not only δtrack, but also δtrack*
// (conjugate) that would describe how track index changes if going A<-B ?
// (conjugate) that would describe how track index changes if going A<-B ?
δBtail
.
trackIdx
.
U
pdat
e
(
trackNew
)
δBtail
.
trackIdx
.
U
nionInplac
e
(
trackNew
)
return
nil
return
nil
}
}
...
...
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