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
// It semantically consists of
//
// []δB ; rev ∈ (tail, head]
// atTail XXX no need (see vvv)
//
// where δB represents a change in BTrees space
//
// δB:
// .rev↑
// {} root -> {}(key, δvalue) XXX was 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)
// {} root -> {}(key, δvalue)
//
// 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
...
...
@@ -62,7 +56,7 @@ const debugΔBtail = false
//
// Δ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
// .ForgetPast(revCut) - forget changes past revCut
...
...
@@ -80,7 +74,7 @@ const debugΔBtail = false
//
// 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?
//
// See also zodb.ΔTail
...
...
@@ -775,7 +769,8 @@ func (δTtail *ΔTtail) forgetPast(revCut zodb.Tid) {
//
// 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
)
{
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 at not ∈ (tail, head] -> panic
...
...
@@ -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
())
}
err
=
δBtail
.
rebuild1IfNeeded
(
root
.
POid
()
)
err
=
δBtail
.
rebuild1IfNeeded
(
root
Oid
)
if
err
!=
nil
{
return
}
δTtail
:=
δBtail
.
vδTbyRoot
[
root
.
POid
()
]
δTtail
:=
δBtail
.
vδTbyRoot
[
root
Oid
]
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
...
...
@@ -823,12 +818,12 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
return
}
//
key not in history tail at all
.
//
use @head[key]
//
XXX can we avoid requiring live root?
//
@tail[key] is not present - key was not changing in (tail, head].
//
since at ∈ (tail, head] we can use @head[key] as the result
//
δBtail[key] is not present - key was not changing in (tail, head]
.
//
since at ∈ (tail, head] as the result we can use @rev[key] for any
// rev ∈ (tail, head].
//
//
XXX can we avoid requiring live root? (think again afresh)
//
XXX -> move handling of "key not in δBtail -> to δFtail.LastBlkRev"
xvalue
,
ok
,
err
:=
root
.
Get
(
ctx
,
key
)
if
!
ok
{
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