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
effe6404
Commit
effe6404
authored
May 11, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4a1737b4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
wcfs/δbtail.go
wcfs/δbtail.go
+19
-4
No files found.
wcfs/δbtail.go
View file @
effe6404
...
@@ -497,6 +497,7 @@ func (orig *ΔBtail) clone() *ΔBtail {
...
@@ -497,6 +497,7 @@ func (orig *ΔBtail) clone() *ΔBtail {
return
klon
return
klon
}
}
/*
// newΔTtail creates new empty ΔTtail object.
// newΔTtail creates new empty ΔTtail object.
func newΔTtail() *ΔTtail {
func newΔTtail() *ΔTtail {
return &ΔTtail{
return &ΔTtail{
...
@@ -504,6 +505,7 @@ func newΔTtail() *ΔTtail {
...
@@ -504,6 +505,7 @@ func newΔTtail() *ΔTtail {
lastRevOf: make(map[Key]zodb.Tid),
lastRevOf: make(map[Key]zodb.Tid),
}
}
}
}
*/
// (tail, head] coverage
// (tail, head] coverage
func
(
δBtail
*
ΔBtail
)
Head
()
zodb
.
Tid
{
return
δBtail
.
δZtail
.
Head
()
}
func
(
δBtail
*
ΔBtail
)
Head
()
zodb
.
Tid
{
return
δBtail
.
δZtail
.
Head
()
}
...
@@ -555,10 +557,12 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { //
...
@@ -555,10 +557,12 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { //
}
}
}
}
/*
_, ok := δBtail.byRoot[root]
_, ok := δBtail.byRoot[root]
if !ok {
if !ok {
δBtail.byRoot[root] = newΔTtail()
δBtail.byRoot[root] = newΔTtail()
}
}
*/
// XXX update diff XXX here? or as separate step?
// XXX update diff XXX here? or as separate step?
// XXX update lastRevOf
// XXX update lastRevOf
...
@@ -651,9 +655,6 @@ func (δBtail *ΔBtail) rebuild() (err error) {
...
@@ -651,9 +655,6 @@ func (δBtail *ΔBtail) rebuild() (err error) {
// XXX dup wrt Update?
// XXX dup wrt Update?
δZTC
,
δtopsByRoot
:=
δZConnectTracked
(
δZ
.
Changev
,
trackNew
)
// XXX len(δtopsByRoot) == 0 -> skip
var
atPrev
zodb
.
Tid
var
atPrev
zodb
.
Tid
if
i
>
0
{
if
i
>
0
{
atPrev
=
vδZ
[
i
-
1
]
.
Rev
atPrev
=
vδZ
[
i
-
1
]
.
Rev
...
@@ -661,6 +662,17 @@ func (δBtail *ΔBtail) rebuild() (err error) {
...
@@ -661,6 +662,17 @@ func (δBtail *ΔBtail) rebuild() (err error) {
atPrev
=
δBtail
.
δZtail
.
Tail
()
atPrev
=
δBtail
.
δZtail
.
Tail
()
}
}
δZTC
,
δtopsByRoot
:=
δZConnectTracked
(
δZ
.
Changev
,
trackNew
)
tracef
(
"
\n
rebuild @%s <- @%s
\n
"
,
atPrev
,
δZ
.
Rev
)
tracef
(
"δZ:
\t
%v
\n
"
,
δZ
.
Changev
)
tracef
(
"trackNew: %v
\n
"
,
trackNew
)
tracef
(
"trackIdx: %v
\n
"
,
δBtail
.
trackIdx
)
// XXX needed?
defer
tracef
(
"
\n\n
"
)
// XXX len(δtopsByRoot) == 0 -> skip
// open ZODB connection corresponding to "current" and "prev" states
// open ZODB connection corresponding to "current" and "prev" states
txn
,
ctx
:=
transaction
.
New
(
context
.
TODO
())
txn
,
ctx
:=
transaction
.
New
(
context
.
TODO
())
defer
txn
.
Abort
()
// XXX -> into func() or don't use defer
defer
txn
.
Abort
()
// XXX -> into func() or don't use defer
...
@@ -682,6 +694,8 @@ func (δBtail *ΔBtail) rebuild() (err error) {
...
@@ -682,6 +694,8 @@ func (δBtail *ΔBtail) rebuild() (err error) {
return
err
return
err
}
}
tracef
(
"-> root<%s> δkv*: %v
\n
"
,
root
,
δT
)
if
len
(
δT
)
==
0
{
// an object might be resaved without change
if
len
(
δT
)
==
0
{
// an object might be resaved without change
continue
continue
}
}
...
@@ -700,7 +714,6 @@ func (δBtail *ΔBtail) rebuild() (err error) {
...
@@ -700,7 +714,6 @@ func (δBtail *ΔBtail) rebuild() (err error) {
// XXX lastRevOf: ...,
// XXX lastRevOf: ...,
}
}
δBtail
.
byRoot
[
root
]
=
δTtail
δBtail
.
byRoot
[
root
]
=
δTtail
}
}
// δTtail.vδT[i] <- merge δT*
// δTtail.vδT[i] <- merge δT*
...
@@ -784,6 +797,8 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
...
@@ -784,6 +797,8 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
return
ΔB
{},
err
return
ΔB
{},
err
}
}
tracef
(
"
\n
-> root<%s> δkv: %v
\n
"
,
root
,
δT
)
if
len
(
δT
)
>
0
{
// an object might be resaved without change
if
len
(
δT
)
>
0
{
// an object might be resaved without change
δB
.
ByRoot
[
root
]
=
δT
δB
.
ByRoot
[
root
]
=
δT
δTtail
,
ok
:=
δBtail
.
byRoot
[
root
]
δTtail
,
ok
:=
δBtail
.
byRoot
[
root
]
...
...
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