Commit ef12f1da authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 597bb439
...@@ -32,10 +32,14 @@ import ( ...@@ -32,10 +32,14 @@ import (
type Tree = btree.LOBTree type Tree = btree.LOBTree
type Bucket = btree.LOBucket type Bucket = btree.LOBucket
// PathMap is a residency index which maps BTree|Bucket to top tree element. // PathSet is a collection of BTree paths.
// //
// PathMap is not safe for concurrent access. // For example it can be a set of visited BTree paths.
type PathMap struct { // There is no requirement that paths belong to only one single BTree.
//
// PathSet is not safe for concurrent access.
type PathSet struct {
// residency index which maps BTree|Bucket to top tree element.
residencyIdx map[zodb.Oid]SetTree // oid -> {} roots residencyIdx map[zodb.Oid]SetTree // oid -> {} roots
} }
...@@ -43,7 +47,9 @@ type PathMap struct { ...@@ -43,7 +47,9 @@ type PathMap struct {
// //
// path[0] signifies a root. // path[0] signifies a root.
// All path elemens must be Tree except last one which must be Bucket. // All path elemens must be Tree except last one which must be Bucket.
func (m *PathMap) Add(path []zodb.IPersistent) { //
// XXX catch cycles on add?
func (m *PathSet) Add(path []zodb.IPersistent) {
l := len(path) l := len(path)
if l == 0 { if l == 0 {
panic("empty path") panic("empty path")
...@@ -82,7 +88,9 @@ func (m *PathMap) Add(path []zodb.IPersistent) { ...@@ -82,7 +88,9 @@ func (m *PathMap) Add(path []zodb.IPersistent) {
// returned are: roots of changed trees. // returned are: roots of changed trees.
// //
// XXX stub. // XXX stub.
func (m *PathMap) Invalidates(changev []zodb.Oid) SetTree { //
// TODO toposort changev wrt nodes ordering (defined by traversed paths) and do δbtree top-down.
func (m *PathSet) Invalidates(changev []zodb.Oid) SetTree {
toinvalidate := make(SetTree) toinvalidate := make(SetTree)
for _, oid := range changev { for _, oid := range changev {
......
...@@ -182,6 +182,8 @@ i.e. exactly as for buckets and it accumulates to global Δ. ...@@ -182,6 +182,8 @@ i.e. exactly as for buckets and it accumulates to global Δ.
The globally-accumulated Δ is the answer for δ(BTree, (@new, []oid)) The globally-accumulated Δ is the answer for δ(BTree, (@new, []oid))
top-down order is obtained via toposort({oid}) wrt visited PathSet.
XXX -> internal/btreediff ? XXX -> internal/btreediff ?
δ(BTree) in wcfs context: δ(BTree) in wcfs context:
......
...@@ -460,8 +460,8 @@ type BigFileDir struct { ...@@ -460,8 +460,8 @@ type BigFileDir struct {
mu sync.Mutex mu sync.Mutex
fileTab map[zodb.Oid]*BigFile fileTab map[zodb.Oid]*BigFile
// residency index for btree|bucket -> which file // visited BTree nodes -> which file + ordering for toposort on δbtree
btreeMap *δbtree.PathMap blktabLoaded *δbtree.PathSet
} }
// /(head|<rev>)/bigfile/<bigfileX> - served by BigFile. // /(head|<rev>)/bigfile/<bigfileX> - served by BigFile.
...@@ -1162,7 +1162,7 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) error { ...@@ -1162,7 +1162,7 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) error {
close(loading.ready) close(loading.ready)
// XXX locking // XXX locking
_ = treepath // TODO -> btreeMap x.blktabVisited.Add(treepath)
// XXX before loading.ready? // XXX before loading.ready?
blkrevmax, _ := f.δFtail.LastRevOf(blk, zbf.PJar().At()) blkrevmax, _ := f.δFtail.LastRevOf(blk, zbf.PJar().At())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment