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
190617f5
Commit
190617f5
authored
Jul 20, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e072a39f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
19 deletions
+14
-19
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+14
-19
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
190617f5
...
@@ -43,18 +43,12 @@ const debugΔBtail = false
...
@@ -43,18 +43,12 @@ const debugΔBtail = false
// It semantically consists of
// It semantically consists of
//
//
// []δB ; rev ∈ (tail, head]
// []δB ; rev ∈ (tail, head]
// atTail XXX no need (see vvv)
//
//
// where δB represents a change in BTrees space
// where δB represents a change in BTrees space
//
//
// δB:
// δB:
// .rev↑
// .rev↑
// {} root -> {}(key, δvalue) XXX was value
// {} root -> {}(key, δvalue)
//
// and atTail keeps set of k/v @tail for keys changed in (tail, head]
//
// atTail: XXX no need for atTail as we have δvalue.Old
// {} root -> {}(key, value)
//
//
// It covers only changes to keys from tracked subset of BTrees parts.
// It covers only changes to keys from tracked subset of BTrees parts.
// In particular a key that was not explicitly requested to be tracked, even if
// In particular a key that was not explicitly requested to be tracked, even if
...
@@ -62,7 +56,7 @@ const debugΔBtail = false
...
@@ -62,7 +56,7 @@ const debugΔBtail = false
//
//
// ΔBtail provides the following operations:
// ΔBtail provides the following operations:
//
//
// .Track(path) - start tracking tree nodes and keys; root=path[0], keys=path[-1].
keys XXX keys not correct - e.g. track missing key
// .Track(path) - start tracking tree nodes and keys; root=path[0], keys=path[-1].
(lo,hi]
//
//
// .Update(δZ) -> δB - update BTree δ tail given raw ZODB changes
// .Update(δZ) -> δB - update BTree δ tail given raw ZODB changes
// .ForgetPast(revCut) - forget changes past revCut
// .ForgetPast(revCut) - forget changes past revCut
...
@@ -80,7 +74,7 @@ const debugΔBtail = false
...
@@ -80,7 +74,7 @@ const debugΔBtail = false
//
//
// XXX incremental; not full coverage
// XXX incremental; not full coverage
//
//
// ΔBtail is not safe for concurrent access.
// ΔBtail is not safe for concurrent access.
XXX rework
// XXX -> multiple readers / single writer?
// XXX -> multiple readers / single writer?
//
//
// See also zodb.ΔTail
// See also zodb.ΔTail
...
@@ -775,7 +769,8 @@ func (δTtail *ΔTtail) forgetPast(revCut zodb.Tid) {
...
@@ -775,7 +769,8 @@ func (δTtail *ΔTtail) forgetPast(revCut zodb.Tid) {
//
//
// XXX root -> Oid ?
// XXX root -> Oid ?
func
(
δBtail
*
ΔBtail
)
GetAt
(
ctx
context
.
Context
,
root
*
Tree
,
key
Key
,
at
zodb
.
Tid
)
(
value
Value
,
ok
bool
,
rev
zodb
.
Tid
,
revExact
bool
,
err
error
)
{
func
(
δBtail
*
ΔBtail
)
GetAt
(
ctx
context
.
Context
,
root
*
Tree
,
key
Key
,
at
zodb
.
Tid
)
(
value
Value
,
ok
bool
,
rev
zodb
.
Tid
,
revExact
bool
,
err
error
)
{
defer
xerr
.
Contextf
(
&
err
,
"δBtail: root<%s>: get %d @%s"
,
root
.
POid
(),
key
,
at
)
rootOid
:=
root
.
POid
()
defer
xerr
.
Contextf
(
&
err
,
"δBtail: root<%s>: get %d @%s"
,
rootOid
,
key
,
at
)
// XXX key not tracked -> panic
// XXX key not tracked -> panic
// XXX at not ∈ (tail, head] -> panic
// XXX at not ∈ (tail, head] -> panic
...
@@ -786,14 +781,14 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
...
@@ -786,14 +781,14 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
panicf
(
"δBtail: root.at (@%s) != head (@%s)"
,
rootAt
,
δBtail
.
Head
())
panicf
(
"δBtail: root.at (@%s) != head (@%s)"
,
rootAt
,
δBtail
.
Head
())
}
}
err
=
δBtail
.
rebuild1IfNeeded
(
root
.
POid
()
)
err
=
δBtail
.
rebuild1IfNeeded
(
root
Oid
)
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
δTtail
:=
δBtail
.
vδTbyRoot
[
root
.
POid
()
]
δTtail
:=
δBtail
.
vδTbyRoot
[
root
Oid
]
if
δTtail
==
nil
{
if
δTtail
==
nil
{
panicf
(
"δBtail: root<%s> not tracked"
,
root
.
POid
()
)
panicf
(
"δBtail: root<%s> not tracked"
,
root
Oid
)
}
}
// XXX -> index lastXXXOf(key) | linear scan ↓ looking for change <= at
// XXX -> index lastXXXOf(key) | linear scan ↓ looking for change <= at
...
@@ -823,12 +818,12 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
...
@@ -823,12 +818,12 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
return
return
}
}
//
key not in history tail at all
.
//
δBtail[key] is not present - key was not changing in (tail, head]
.
//
use @head[key]
//
since at ∈ (tail, head] as the result we can use @rev[key] for any
// rev ∈ (tail, head].
//
XXX can we avoid requiring live root?
//
//
@tail[key] is not present - key was not changing in (tail, head].
//
XXX can we avoid requiring live root? (think again afresh)
//
since at ∈ (tail, head] we can use @head[key] as the result
//
XXX -> move handling of "key not in δBtail -> to δFtail.LastBlkRev"
xvalue
,
ok
,
err
:=
root
.
Get
(
ctx
,
key
)
xvalue
,
ok
,
err
:=
root
.
Get
(
ctx
,
key
)
if
!
ok
{
if
!
ok
{
value
=
VDEL
value
=
VDEL
...
...
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