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
dbc57c35
Commit
dbc57c35
authored
Apr 14, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3f898826
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
49 deletions
+53
-49
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+53
-49
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
dbc57c35
...
...
@@ -22,53 +22,6 @@
// TODO move -> btree when ΔTail matures.
package
xbtree
// δ(BTree) notes
// ==============
//
// input: BTree, (@new, []oid) -> find out δ(BTree) i.e. {-k(v), +k'(v'), ...}
//
// - oid ∈ Bucket
// - oid ∈ BTree
//
// Bucket:
//
// old = {k -> v}
// new = {k' -> v'}
//
// Δ = -k(v), +k(v), ...
//
// => for all buckets
//
// Δ accumulates to []δk(v)[n+,n-] n+ ∈ {0,1}, n- ∈ {0,1}, if n+=n- - cancel
//
//
// BTree:
//
// old = {k -> B} or {k -> T}
// new = {k' -> B'} or {k' -> T'}
//
// Δ = -k(B), +k(B), -k(T), +K(T), ...
//
// we translate (in top-down order):
//
// k(B) -> {} of k(v)
// k(T) -> {} of k(B) -> {} of k(v)
//
// which gives
//
// Δ = k(v), +k(v), ...
//
// i.e. exactly as for buckets and it accumulates to global Δ.
//
// The globally-accumulated Δ is the answer for δ(BTree, (@new, []oid))
//
// top-down order is obtained via toposort({oid}) wrt visited PathSet.
//
// δ(BTree) in wcfs context:
//
// . -k(blk) -> invalidate #blk
// . +k(blk) -> invalidate #blk (e.g. if blk was previously read as hole)
//go:generate ../../gen-set xbtree Tree *Tree zset_tree.go
// //go:generate ../../gen-set xbtree Oid zodb.Oid zset_oid.go
//go:generate ../../gen-set xbtree Object interface{} zset_object.go
...
...
@@ -92,6 +45,7 @@ type Value = zodb.Oid // XXX assumes key points to IPersistent
// # trees changed by a revision
// [](rev↑, []root) ; rev ∈ (tail, head]
//
// # for every tree:
// {} root ->
// # k/v change history ; rev ∈ (tail, head]
// [](rev↑, {}(key, value))
...
...
@@ -101,6 +55,8 @@ type Value = zodb.Oid // XXX assumes key points to IPersistent
//
// A tree nodes become tracked via Track(path) request.
//
// XXX which operations are provided.
//
// An example for tracked set is a set of visited BTree paths.
// There is no requirement that tracked set belongs to only one single BTree.
//
...
...
@@ -112,10 +68,10 @@ type Value = zodb.Oid // XXX assumes key points to IPersistent
//
// ΔTail is not safe for concurrent access.
type
ΔTail
struct
{
δZtail
*
zodb
.
ΔTail
// raw ZODB changes; Kept to rebuild δBtail
(XXX)
after new Track
δZtail
*
zodb
.
ΔTail
// raw ZODB changes; Kept to rebuild δBtail
/byRoot
after new Track
δBtail
[]
ΔRevEntry
// which BTree were changed; Noted only by keys ∈ tracket subset
byRoot
map
[
*
Tree
]
*
ΔTreeTail
byRoot
map
[
*
Tree
]
*
ΔTreeTail
// root -> k/v change history; only for keys ∈ tracket subset
// XXX or ask client provide db on every call?
db
*
zodb
.
DB
// to open connections to load new/old tree|buckets
...
...
@@ -291,3 +247,51 @@ func (btail *ΔTail) LastRevOf(root *Tree, key Key, at zodb.Tid) (_ zodb.Tid, ex
func
(
btail
*
ΔTail
)
ForgetPast
(
revCut
zodb
.
Tid
)
{
btail
.
δZtail
.
ForgetPast
(
revCut
)
// XXX stub
}
// δ(BTree) notes
// ==============
//
// input: BTree, (@new, []oid) -> find out δ(BTree) i.e. {-k(v), +k'(v'), ...}
//
// - oid ∈ Bucket
// - oid ∈ BTree
//
// Bucket:
//
// old = {k -> v}
// new = {k' -> v'}
//
// Δ = -k(v), +k(v), ...
//
// => for all buckets
//
// Δ accumulates to []δk(v)[n+,n-] n+ ∈ {0,1}, n- ∈ {0,1}, if n+=n- - cancel
//
//
// BTree:
//
// old = {k -> B} or {k -> T}
// new = {k' -> B'} or {k' -> T'}
//
// Δ = -k(B), +k(B), -k(T), +K(T), ...
//
// we translate (in top-down order):
//
// k(B) -> {} of k(v)
// k(T) -> {} of k(B) -> {} of k(v)
//
// which gives
//
// Δ = k(v), +k(v), ...
//
// i.e. exactly as for buckets and it accumulates to global Δ.
//
// The globally-accumulated Δ is the answer for δ(BTree, (@new, []oid))
//
// top-down order is obtained via toposort({oid}) wrt visited PathSet.
//
// δ(BTree) in wcfs context:
//
// . -k(blk) -> invalidate #blk
// . +k(blk) -> invalidate #blk (e.g. if blk was previously read as hole)
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