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
a17fd280
Commit
a17fd280
authored
Jun 22, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
18010d1d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
53 deletions
+44
-53
wcfs/internal/xbtree/pptreesubset.go
wcfs/internal/xbtree/pptreesubset.go
+0
-18
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+41
-35
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+3
-0
No files found.
wcfs/internal/xbtree/pptreesubset.go
View file @
a17fd280
...
...
@@ -513,21 +513,3 @@ func (S PPTreeSubSet) ApplyΔ(δ *ΔPPTreeSubSet) {
S
.
xUnionInplace
(
δ
.
Add
)
S
.
xfixup
(
+
1
,
δ
.
δnchildNonLeafs
)
}
// XXX kill
// XXX returns PPTreeSubSet that corresponds to nodes that correspond to δtkeycov.
// XXX correct?
func
(
δ
*
ΔPPTreeSubSet
)
XXXδtkeycovSet
()
(
S
PPTreeSubSet
)
{
S
=
PPTreeSubSet
{}
δ
.
Del
.
verify
()
δ
.
Add
.
verify
()
defer
S
.
verify
()
//S.xfixup(-1, δ.δnchildNonLeafs)
S
.
xUnionInplace
(
δ
.
Add
)
S
.
xDifferenceInplace
(
δ
.
Del
)
//S.xfixup(+1, δ.δnchildNonLeafs)
return
S
}
wcfs/internal/xbtree/δbtail.go
View file @
a17fd280
...
...
@@ -366,36 +366,7 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB
break
}
widenTrackNew
:=
func
()
error
{
// XXX errctx, debug
txn
,
ctx
:=
transaction
.
New
(
context
.
TODO
())
// XXX
defer
txn
.
Abort
()
zhead
,
err
:=
db
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{
At
:
δZtail
.
Head
()});
/*X*/
if
err
!=
nil
{
return
err
}
xtree
,
err
:=
zhead
.
Get
(
ctx
,
root
);
/*X*/
if
err
!=
nil
{
return
err
}
tree
:=
xtree
.
(
*
Tree
)
// must succeed XXX better explicit panic?
top
:=
&
nodeInRange
{
prefix
:
nil
,
lo
:
KeyMin
,
hi_
:
KeyMax
,
node
:
tree
}
V
:=
rangeSplit
{
top
}
for
_
,
r
:=
range
δtkeycov
.
AllRanges
()
{
lo
:=
r
.
lo
for
{
b
,
err
:=
V
.
GetToLeaf
(
ctx
,
lo
);
/*X*/
if
err
!=
nil
{
return
err
}
trackNew
.
AddPath
(
b
.
Path
())
// continue with next right bucket until r coverage is complete
if
r
.
hi_
<=
b
.
hi_
{
break
}
lo
=
b
.
hi_
+
1
}
}
return
nil
}
err
:=
widenTrackNew
()
err
:=
widenTrackNew
(
trackNew
,
δtkeycov
,
root
,
δZtail
.
Head
(),
db
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -404,6 +375,37 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB
return
trackNew
,
nil
}
// widenTrackNew widens trackNew to cover δtkeycov.
func
widenTrackNew
(
trackNew
PPTreeSubSet
,
δtkeycov
*
RangedKeySet
,
root
zodb
.
Oid
,
at
zodb
.
Tid
,
db
*
zodb
.
DB
)
error
{
// XXX errctx, debug
txn
,
ctx
:=
transaction
.
New
(
context
.
TODO
())
// XXX
defer
txn
.
Abort
()
zhead
,
err
:=
db
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{
At
:
at
});
/*X*/
if
err
!=
nil
{
return
err
}
xtree
,
err
:=
zhead
.
Get
(
ctx
,
root
);
/*X*/
if
err
!=
nil
{
return
err
}
tree
:=
xtree
.
(
*
Tree
)
// must succeed XXX better explicit panic?
top
:=
&
nodeInRange
{
prefix
:
nil
,
lo
:
KeyMin
,
hi_
:
KeyMax
,
node
:
tree
}
V
:=
rangeSplit
{
top
}
for
_
,
r
:=
range
δtkeycov
.
AllRanges
()
{
lo
:=
r
.
lo
for
{
b
,
err
:=
V
.
GetToLeaf
(
ctx
,
lo
);
/*X*/
if
err
!=
nil
{
return
err
}
trackNew
.
AddPath
(
b
.
Path
())
// continue with next right bucket until r coverage is complete
if
r
.
hi_
<=
b
.
hi_
{
break
}
lo
=
b
.
hi_
+
1
}
}
return
nil
}
// rebuild1 rebuilds δT for single δZ.
//
// δtrackNew/δtkeycov represents how trackNew changes when going through `atPrev <- δZ.Rev` .
...
...
@@ -510,14 +512,18 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
for
root
,
δT1
:=
range
δB1
.
ByRoot
{
δTtail
:=
δBtail
.
vδTbyRoot
[
root
]
// must succeed
// δtkeycov1 != ø -> rebuild δTtail
// δtkeycov1 != ø -> rebuild δTtail
with trackNew ~= δtkeycov1
if
!
δT1
.
δtkeycov1
.
Empty
()
&&
δBtail
.
δZtail
.
Len
()
>
1
{
//δTtail.trackNew = ... // ~δtkeycov1
//δTtail.trackNew = nil // XXX stub
δTtail
.
trackNew
=
δT1
.
δtrack
.
XXXδtkeycovSet
()
// ~δtkeycov1 XXX correct?
trackNew
:=
PPTreeSubSet
{}
err
:=
widenTrackNew
(
trackNew
,
δT1
.
δtkeycov1
,
root
,
δBtail
.
Head
(),
δBtail
.
db
)
if
err
!=
nil
{
return
ΔB
{},
err
}
// XXX assert δTtail.trackNew.Empty()
δTtail
.
trackNew
=
trackNew
// XXX vvv we can skip computing diff for HEAD~..HEAD (we just
// computed it in _Update1)
// computed it in _Update1)
? (or not - trackNew is as of @head ?)
δtrackSet
,
err
:=
δTtail
.
rebuild
(
root
,
δBtail
.
δZtail
,
δBtail
.
db
)
if
err
!=
nil
{
return
ΔB
{},
err
...
...
wcfs/internal/xbtree/δbtail_test.go
View file @
a17fd280
...
...
@@ -1067,6 +1067,8 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
// // δkv2_2 = t2.δxkv / kadj10(kadj21(kadj12(keys1) | keys2))
//// keys12_2 := keys1_2.Union(keys2)
//// keys12_0 := kadj10.Map(kadj21.Map(keys12_2))
/*
fmt.Printf("\n\n\nKKK\nkeys1=%s keys2=%s\n", keys1, keys2)
fmt.Printf("keys12R2=%s\n", keys12R2)
...
...
@@ -1077,6 +1079,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
fmt.Printf("kadj12: %v\n", kadj12)
fmt.Printf("t2.xkv.trackSet(%s) -> %s", keys12R2, t2.xkv.trackSet(keys12R2))
fmt.Printf("\n\n\n")
*/
// δkvX_k12R2 = tX.δxkv / keys12R2
...
...
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