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
6d77591b
Commit
6d77591b
authored
Jun 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6092b390
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
6 deletions
+28
-6
wcfs/δbtail.go
wcfs/δbtail.go
+28
-6
No files found.
wcfs/δbtail.go
View file @
6d77591b
...
...
@@ -119,13 +119,24 @@ type ΔBtail struct {
// tracked index: BTree|Bucket -> top tree element.
// XXX allow only single root (else it is "tree corrupt") ?
// XXX as of @head state
trackIdx
map
[
zodb
.
Oid
]
SetOid
// oid -> {} roots
//
trackIdx map[zodb.Oid]SetOid // oid -> {} roots
// tracked objects that are not yet taken into account in current δBtail
trackNew
SetOid
// tracked keys that are not in current version of the tree.
tkdel
SetKey
// tracked nodes index: node -> parent + keys tracked under this node
trackIdx
map
[
zodb
.
Oid
]
nodeTrack
}
// XXX place
// nodeTrack represents tracking information about a node.
type
nodeTrack
struct
{
parent
zodb
.
Oid
// parent node | InvalidOid for root
trackedKeys
SetKey
// keys tracked under this node; nil for root
}
// ΔB represents a change in BTrees space.
...
...
@@ -173,7 +184,8 @@ func NewΔBtail(at0 zodb.Tid, db *zodb.DB) *ΔBtail {
return
&
ΔBtail
{
δZtail
:
zodb
.
NewΔTail
(
at0
),
byRoot
:
make
(
map
[
zodb
.
Oid
]
*
ΔTtail
),
trackIdx
:
make
(
map
[
zodb
.
Oid
]
SetOid
),
// trackIdx: make(map[zodb.Oid]SetOid),
trackIdx
:
map
[
zodb
.
Oid
]
nodeTrack
{},
tkdel
:
SetKey
{},
db
:
db
,
}
...
...
@@ -227,16 +239,26 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
for
_
,
node
:=
range
path
{
oidv
=
append
(
oidv
,
node
.
POid
())
}
fmt
.
Printf
(
"Track %v
\n
"
,
oidv
)
parent
:=
zodb
.
InvalidOid
for
_
,
node
:=
range
path
{
oid
:=
node
.
POid
()
// XXX check for InvalidOid (e.g. T/B1:a with bucket not having its own oid.
nodeRoots
,
ok
:=
δBtail
.
trackIdx
[
oid
]
track
,
ok
:=
δBtail
.
trackIdx
[
oid
]
if
!
ok
{
nodeRoots
=
make
(
SetOid
)
δBtail
.
trackIdx
[
oid
]
=
nodeRoots
track
=
nodeTrack
{
parent
:
parent
}
if
parent
!=
zodb
.
InvalidOid
{
track
.
trackedKeys
=
SetKey
{}
}
δBtail
.
trackIdx
[
oid
]
=
track
// XXX .trackNew += oid
}
nodeRoots
.
Add
(
root
)
if
track
.
parent
!=
parent
{
// XXX -> error (e.g. due to corrupt data in ZODB)
panicf
(
"node %s is reachable from multiple parents: %s %s"
,
oid
,
track
.
parent
,
parent
)
}
track
.
trackedKeys
.
Add
(
key
)
parent
=
oid
}
_
,
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