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
2716a284
Commit
2716a284
authored
May 11, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
19f3a09d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
15 deletions
+23
-15
wcfs/δbtail.go
wcfs/δbtail.go
+21
-13
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+2
-2
No files found.
wcfs/δbtail.go
View file @
2716a284
...
@@ -635,16 +635,24 @@ func (tidx trackIndex) AddPath(path []zodb.Oid) {
...
@@ -635,16 +635,24 @@ func (tidx trackIndex) AddPath(path []zodb.Oid) {
}
}
}
}
// rebuild rebuilds ΔBt
ree
taking trackNew requests into account. XXX
// rebuild rebuilds ΔBt
ail
taking trackNew requests into account. XXX
// XXX place
// XXX place
func
(
δBtail
*
ΔBtail
)
rebuild
()
{
func
(
δBtail
*
ΔBtail
)
rebuild
()
{
// XXX stub
// XXX locking
/*
// vδT <- merge treediff(lo..hi/trackNew)
vδZ := δBtail.δZtail.Data()
for i := len(vδZ)-1; i>=0; i-- {
δZ := vδZ[i]
δZTC, δtopsByRoot := δBtail.δZConnectTracked(δZ, trackNew)
}
*/
// merge .trackNew into .trackIdx
// merge .trackNew into .trackIdx
δBtail
.
trackIdx
.
Update
(
δBtail
.
trackNew
)
δBtail
.
trackIdx
.
Update
(
δBtail
.
trackNew
)
δBtail
.
trackNew
=
trackIndex
{}
δBtail
.
trackNew
=
trackIndex
{}
return
panic
(
"TODO"
)
}
}
// Update updates δB with per-object level ZODB changes.
// Update updates δB with per-object level ZODB changes.
...
@@ -669,7 +677,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
...
@@ -669,7 +677,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
tracef
(
"trackIdx: %v
\n
"
,
δBtail
.
trackIdx
)
tracef
(
"trackIdx: %v
\n
"
,
δBtail
.
trackIdx
)
tracef
(
"holeIdxByRoot: %v
\n
"
,
δBtail
.
holeIdxByRoot
)
tracef
(
"holeIdxByRoot: %v
\n
"
,
δBtail
.
holeIdxByRoot
)
δZTC
,
δtopsByRoot
:=
δ
Btail
.
δZConnectTracked
(
δZ
)
δZTC
,
δtopsByRoot
:=
δ
ZConnectTracked
(
δZ
,
δBtail
.
trackIdx
)
δB
:=
ΔB
{
Rev
:
δZ
.
Tid
,
ByRoot
:
make
(
map
[
zodb
.
Oid
]
map
[
Key
]
ΔValue
)}
δB
:=
ΔB
{
Rev
:
δZ
.
Tid
,
ByRoot
:
make
(
map
[
zodb
.
Oid
]
map
[
Key
]
ΔValue
)}
...
@@ -718,13 +726,13 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
...
@@ -718,13 +726,13 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
// for example for e.g. t₀->t₁->b₂ if δZ/T={t₀ b₂} -> δZ/TC=δZ/T+{t₁}
// for example for e.g. t₀->t₁->b₂ if δZ/T={t₀ b₂} -> δZ/TC=δZ/T+{t₁}
//
//
// δtopsByRoot = {} root -> {top changed nodes in that tree}
// δtopsByRoot = {} root -> {top changed nodes in that tree}
func
(
δBtail
*
ΔBtail
)
δZConnectTracked
(
δZv
*
zodb
.
EventCommit
)
(
δZTC
SetOid
,
δtopsByRoot
map
[
zodb
.
Oid
]
SetOid
)
{
func
δZConnectTracked
(
δZv
*
zodb
.
EventCommit
,
T
trackIndex
)
(
δZTC
SetOid
,
δtopsByRoot
map
[
zodb
.
Oid
]
SetOid
)
{
δZ
:=
SetOid
{};
for
_
,
δ
:=
range
δZv
.
Changev
{
δZ
.
Add
(
δ
)
}
δZ
:=
SetOid
{};
for
_
,
δ
:=
range
δZv
.
Changev
{
δZ
.
Add
(
δ
)
}
δZTC
=
SetOid
{}
δZTC
=
SetOid
{}
δtopsByRoot
=
map
[
zodb
.
Oid
]
SetOid
{}
δtopsByRoot
=
map
[
zodb
.
Oid
]
SetOid
{}
for
δ
:=
range
δZ
{
for
δ
:=
range
δZ
{
track
,
ok
:=
δBtail
.
trackIdx
[
δ
]
track
,
ok
:=
T
[
δ
]
if
!
ok
{
if
!
ok
{
continue
// not tracked at all
continue
// not tracked at all
}
}
...
@@ -759,7 +767,7 @@ func (δBtail *ΔBtail) δZConnectTracked(δZv *zodb.EventCommit) (δZTC SetOid,
...
@@ -759,7 +767,7 @@ func (δBtail *ΔBtail) δZConnectTracked(δZv *zodb.EventCommit) (δZTC SetOid,
}
}
path
=
append
(
path
,
parent
)
path
=
append
(
path
,
parent
)
trackUp
,
ok
:=
δBtail
.
trackIdx
[
parent
]
trackUp
,
ok
:=
T
[
parent
]
if
!
ok
{
if
!
ok
{
panicf
(
"BUG: .p%s -> %s, but %s is not tracked"
,
node
,
parent
,
parent
)
panicf
(
"BUG: .p%s -> %s, but %s is not tracked"
,
node
,
parent
,
parent
)
}
}
...
@@ -1574,10 +1582,10 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
...
@@ -1574,10 +1582,10 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
}
}
// XXX don't need
// XXX don't need
func
(
δBtail
*
ΔBtail
)
SliceByRev
(
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
ΔB
{
//
func (δBtail *ΔBtail) SliceByRev(lo, hi zodb.Tid) /*readonly*/ []ΔB {
δassertSlice
(
δBtail
,
lo
,
hi
)
//
δassertSlice(δBtail, lo, hi)
panic
(
"TODO"
)
//
panic("TODO")
}
//
}
// SliceByRootRev returns history of a tree changes in (lo, hi] range.
// SliceByRootRev returns history of a tree changes in (lo, hi] range.
//
//
...
...
wcfs/δbtail_test.go
View file @
2716a284
...
@@ -1019,7 +1019,7 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
...
@@ -1019,7 +1019,7 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
// XXX verify Get
// XXX verify Get
// verify SliceByRootRev
// verify SliceByRootRev
XXX -> verify δbtail.byRoot[treeRoot] directly
l
:=
len
(
vδTok
)
l
:=
len
(
vδTok
)
vatOK
:=
make
([]
zodb
.
Tid
,
l
)
vatOK
:=
make
([]
zodb
.
Tid
,
l
)
t0
:=
tj
t0
:=
tj
...
@@ -1037,7 +1037,7 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
...
@@ -1037,7 +1037,7 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
atPrev
:=
lo
atPrev
:=
lo
for
i
,
δToid
:=
range
vδToid
{
for
i
,
δToid
:=
range
vδToid
{
vat
[
i
]
=
δToid
.
Rev
vat
[
i
]
=
δToid
.
Rev
δT
:=
XGetδKV
(
db
,
atPrev
,
δToid
.
Rev
,
δToid
.
ΔKV
)
// {} k -> δ(ZBlk(oid).data)
δT
:=
XGetδKV
(
db
,
atPrev
,
δToid
.
Rev
,
δToid
.
ΔKV
)
// {} k -> δ(ZBlk(oid).data)
vδT
=
append
(
vδT
,
δT
)
vδT
=
append
(
vδT
,
δT
)
atPrev
=
δToid
.
Rev
atPrev
=
δToid
.
Rev
}
}
...
...
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