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
ddec8cf5
Commit
ddec8cf5
authored
Apr 03, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f0a60b56
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
17 deletions
+46
-17
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+42
-17
wcfs/wcfs.go
wcfs/wcfs.go
+4
-0
No files found.
wcfs/internal/
δ
btree/δbtail.go
→
wcfs/internal/
x
btree/δbtail.go
View file @
ddec8cf5
...
@@ -17,27 +17,39 @@
...
@@ -17,27 +17,39 @@
// See COPYING file for full licensing terms.
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// See https://www.nexedi.com/licensing for rationale and options.
package
δbtree
// Package xbtree complements package lab.nexedi.com/kirr/neo/go/zodb/btree.
// XXX -> another package?
//
// TODO move -> btree when ΔTail matures.
package
xbtree
//go:generate ../../gen-set δbtree Tree *Tree zset_tree.go
//go:generate ../../gen-set δbtree Object interface{} zset_object.go
import
(
import
(
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
)
)
// ΔBTail reprsents tail of revisional changes to BTrees.
type
Tree
=
btree
.
LOBTree
type
Bucket
=
btree
.
LOBucket
type
Node
=
btree
.
LONode
type
Key
=
int64
// ΔTail reprsents tail of revisional changes to BTrees.
//
//
// It semantically consists of
// It semantically consists of
//
//
// [](rev↑,
(tree, []key))
; rev ∈ (tail, head]
// [](rev↑,
[](tree, []key))
; rev ∈ (tail, head]
//
//
// and *partially* covers changes to BTrees.
// and covers changes to tracked subsets of BTrees. A tree subset becomes
// tracked via Track(path) request.
//
//
// XXX δB can convert δZ to btree changes, but only at least for δZ's objects
// XXX δB can convert δZ to btree changes, but only at least for δZ's objects
// that ∈ BTree subgraphs that were explicitly requested to be tracked by δB.
// that ∈ BTree subgraphs that were explicitly requested to be tracked by δB.
//
//
// XXX incremental; not full coverage
// XXX incremental; not full coverage
// XXX
-> ΔBIndex ?
// XXX
concurency safety
type
Δ
B
Tail
struct
{
type
ΔTail
struct
{
//at // = head
//at // = head
δZtail
*
zodb
.
ΔTail
δZtail
*
zodb
.
ΔTail
...
@@ -49,10 +61,24 @@ type ΔBTail struct {
...
@@ -49,10 +61,24 @@ type ΔBTail struct {
rootIdx
map
[
zodb
.
Oid
]
SetTree
// oid -> {} roots
rootIdx
map
[
zodb
.
Oid
]
SetTree
// oid -> {} roots
}
}
// ΔRevEntry represents information about BTrees changes in one revision.
type
ΔRevEntry
struct
{
Rev
zodb
.
Tid
Changev
[]
ΔTree
}
// ΔTree represents changes to one tree.
type
ΔTree
struct
{
Root
XXX
Keyv
[]
Key
}
// Track adds tree path to tracked set.
//
// XXX path is at @at state.
// XXX path is at @at state.
// XXX objects in path must be with .PJar().At() == .head
// XXX objects in path must be with .PJar().At() == .head
// XXX path -> []oid ?
// XXX path -> []oid ?
func
(
δb
*
Δ
BTail
)
Track
(
path
[]
zodb
.
IPersistent
)
{
// XXX Tree|Bucket; path[0] = root
func
(
δb
*
Δ
Tail
)
Track
(
path
[]
Node
)
{
// XXX Tree|Bucket; path[0] = root
/*
/*
root = path[0]
root = path[0]
for obj in path:
for obj in path:
...
@@ -62,12 +88,12 @@ func (δb *ΔBTail) Track(path []zodb.IPersistent) { // XXX Tree|Bucket; path[0]
...
@@ -62,12 +88,12 @@ func (δb *ΔBTail) Track(path []zodb.IPersistent) { // XXX Tree|Bucket; path[0]
// Update updates δB with per-object level ZODB changes.
// Update updates δB with per-object level ZODB changes.
//
//
// XXX return -> [] of (root, []key) that are invalidated.
// Only those objects from δZ that belong to tracked set are guaranteed to be
// taken into account.
//
//
// XXX text ...
// XXX return -> [] of (root, []key) that are invalidated.
// XXX -> Append? -> Invalidate?
// XXX -> + separate SliceByRev? or Data to get diff?
// XXX -> DiffTo ?
func
(
δB
*
ΔTail
)
Update
(
δZ
*
zodb
.
EventCommit
)
{
func
(
δB
*
ΔBTail
)
Update
(
δZ
*
zodb
.
EventCommit
)
{
/*
/*
.δZtail += δZ
.δZtail += δZ
δbZ = {}
δbZ = {}
...
@@ -91,17 +117,16 @@ func (δB *ΔBTail) Update(δZ *zodb.EventCommit) {
...
@@ -91,17 +117,16 @@ func (δB *ΔBTail) Update(δZ *zodb.EventCommit) {
diff(B, B')
diff(B, B')
...
...
XXX rebuild something?
->
[] of (root, []key)
.tailv <-
[] of (root, []key)
*/
*/
}
}
// XXX -> Get(root, key, at) -> (valueOid, rev) ?
// XXX -> Get(root, key, at) -> (valueOid, rev) ?
func
(
δB
*
Δ
B
Tail
)
LastRevOf
(
root
Tree
,
key
Key
,
at
zodb
.
Tid
)
zodb
.
Tid
{
func
(
δB
*
ΔTail
)
LastRevOf
(
root
Tree
,
key
Key
,
at
zodb
.
Tid
)
zodb
.
Tid
{
panic
(
"TODO"
)
// XXX return 0 as stub?
panic
(
"TODO"
)
// XXX return 0 as stub?
}
}
func
(
δB
*
Δ
B
Tail
)
ForgetPast
(
revCut
zodb
.
Tid
)
{
func
(
δB
*
ΔTail
)
ForgetPast
(
revCut
zodb
.
Tid
)
{
panic
(
"TODO"
)
panic
(
"TODO"
)
}
}
wcfs/wcfs.go
View file @
ddec8cf5
...
@@ -248,11 +248,15 @@ package main
...
@@ -248,11 +248,15 @@ package main
// #blk ∈ OS file cache => ZBlk(#blk) + all BTree/Bucket that lead to it ∈ zhead cache(%)
// #blk ∈ OS file cache => ZBlk(#blk) + all BTree/Bucket that lead to it ∈ zhead cache(%)
// (ZBlk* in ghost state)
// (ZBlk* in ghost state)
//
//
// => all BTree/Bucket that lead to blk are tracked (XXX)
//
// The invariant helps on invalidation: if we see a changed oid, and
// The invariant helps on invalidation: if we see a changed oid, and
// zhead.cache.lookup(oid) = ø -> we know we don't have to invalidate OS
// zhead.cache.lookup(oid) = ø -> we know we don't have to invalidate OS
// cache for any part of any file (even if oid relates to a file block - that
// cache for any part of any file (even if oid relates to a file block - that
// block is not cached and will trigger ZODB load on file read).
// block is not cached and will trigger ZODB load on file read).
//
//
// XXX explain why tracked
//
// Currently we maintain this invariant by simply never evicting ZBlk/LOBTree/LOBucket
// Currently we maintain this invariant by simply never evicting ZBlk/LOBTree/LOBucket
// objects from ZODB Connection cache. In the future we may want to try to
// objects from ZODB Connection cache. In the future we may want to try to
// synchronize to kernel freeing its pagecache pages.
// synchronize to kernel freeing its pagecache pages.
...
...
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