Commit d348e51f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 97acef76
......@@ -40,6 +40,7 @@ type Key = int64
type Value = zodb.Oid // assumes key points to IPersistent
// deletion is represented as InvalidOid
type SetKey = SetI64
// XXX SetOID
// ΔBtail represents tail of revisional changes to BTrees.
......@@ -97,7 +98,7 @@ type ΔBtail struct {
db *zodb.DB // to open connections to load new/old tree|buckets
// tracked index: BTree|Bucket -> top tree element.
trackIdx map[zodb.Oid]SetTree // oid -> {} roots XXX root -> oid?
trackIdx map[zodb.Oid]SetTree // oid -> {} roots XXX root -> oid
// tracked objects that are not yet taken into account in current δBtail
trackNew map[zodb.Oid]struct{} // XXX SetOid
......@@ -106,7 +107,7 @@ type ΔBtail struct {
// ΔB represents a change in BTrees space.
type ΔB struct {
Rev zodb.Tid
ByRoot map[*Tree]map[Key]Value // {} root -> {}(key, value)
ByRoot map[zodb.Oid]map[Key]Value // {} root -> {}(key, value)
}
// ΔRoots describes which BTrees were change in one revision.
......@@ -211,18 +212,18 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) ΔB {
δBtail.δZtail.Append(δZ.Tid, δZ.Changev)
// {} root -> []oid changed under that root in tracked set
δZByRoot := map[*Tree][]zodb.Oid{} // XXX -> map[*Tree]SetOid ?
δZByRoot := map[zodb.Oid][]zodb.Oid{} // XXX -> map[*Tree]SetOid ?
for _, oid := range δZ.Changev {
roots, ok := δBtail.trackIdx[oid]
if !ok {
continue
}
for root := range roots {
δZByRoot[root] = append(δZByRoot[root], oid)
δZByRoot[root.POid()] = append(δZByRoot[root.POid()], oid)
}
}
δB := ΔB{Rev: δZ.Tid, ByRoot: make(map[*Tree]map[Key]Value)}
δB := ΔB{Rev: δZ.Tid, ByRoot: make(map[zodb.Oid]map[Key]Value)}
for root := range δZByRoot {
δt, ok := δB.ByRoot[root]
......
......@@ -68,7 +68,7 @@ import (
type ΔFtail struct {
// ΔFtail merges btree.ΔTail with history of ZBlk
δBtail *ΔBtail
fileIdx map[*btree.LOBTree]SetBigFile // root -> {} BigFile XXX root -> oid? XXX as of @head?
fileIdx map[zodb.Oid]SetBigFile // tree-root -> {} BigFile XXX as of @head?
// data with δF changes. Actual for part of tracked set that was taken
// into account.
......@@ -113,7 +113,7 @@ func (z *zblkInΔFtail) inΔFtail() *zblkInΔFtail { return z }
func NewΔFtail(at0 zodb.Tid) *ΔFtail {
return &ΔFtail{
δBtail: NewΔBtail(at0),
fileIdx: make(map[*btree.LOBTree]SetBigFile),
fileIdx: make(map[zodb.Oid]SetBigFile),
trackNew: make(map[*BigFile]map[zodb.Oid]*zblkInΔFtail),
}
}
......@@ -136,10 +136,10 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
func (δFtail *ΔFtail) Track(file *BigFile, blk int64, path []btree.LONode, zblk zBlk) {
δFtail.δBtail.Track(path)
root := path[0].(*btree.LOBTree)
files, ok := δFtail.fileIdx[root]
files, ok := δFtail.fileIdx[root.POid()]
if !ok {
files = SetBigFile{}
δFtail.fileIdx[root] = files
δFtail.fileIdx[root.POid()] = files
}
files.Add(file)
......@@ -200,7 +200,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
for root, δt := range δB.ByRoot {
files := δFtail.fileIdx[root]
if len(files) == 0 {
panicf("ΔFtail: root<%s> -> ø file", root.POid())
panicf("ΔFtail: root<%s> -> ø file", root)
}
for file := range files {
δfile, ok := δF.ByFile[file]
......
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