Commit c63dbe30 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 441e3666
......@@ -99,8 +99,8 @@ type ΔBtail struct {
trackNew map[zodb.Oid]struct{} // XXX SetOid
}
// Δ represents a change in BTrees space.
type Δ struct {
// ΔB represents a change in BTrees space.
type ΔB struct {
Rev zodb.Tid
Change map[*Tree]map[Key]Value // {} root -> {}(key, value)
}
......@@ -206,7 +206,7 @@ func (δBtail *ΔBtail) Track(path []Node) { // XXX Tree|Bucket; path[0] = root
// only those keys, that correspond to tracked subset of δZ.
//
// δZ should include all objects changed by ZODB transaction.
func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) Δ {
func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) ΔB {
δBtail.δZtail.Append(δZ.Tid, δZ.Changev)
// {} root -> []oid changed under that root
......@@ -221,7 +221,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) Δ {
}
}
δB := Δ{Rev: δZ.Tid, Change: make(map[*Tree]map[Key]Value)}
δB := ΔB{Rev: δZ.Tid, Change: make(map[*Tree]map[Key]Value)}
if len(δZByRoot) == 0 {
return δB // tracked set not changed
......@@ -335,10 +335,17 @@ func (δΒtail *ΔBtail) Get(ctx context.Context, root *Tree, key Key, at zodb.T
return
}
// XXX SliceByRev
// XXX
func (δBtail *ΔBtail) SliceByRev(lo, hi zodb.Tid) /*readonly*/ []ΔB {
δassertSlice(δBtail, lo, hi)
panic("TODO")
}
// XXX
func (δBtail *ΔBtail) SliceByRootRev(root *Tree, lo, hi zodb.Tid) /*readonly*/[]ΔTree {
δassertSlice(δBtail, lo, hi)
panic("TODO")
}
......@@ -388,3 +395,15 @@ func (δBtail *ΔBtail) SliceByRootRev(root *Tree, lo, hi zodb.Tid) /*readonly*/
//
// . -k(blk) -> invalidate #blk
// . +k(blk) -> invalidate #blk (e.g. if blk was previously read as hole)
// misc
// δassertSlice asserts that δ.tail ≤ lo ≤ hi ≤ δ.head
func δassertSlice(δ interface { Head() zodb.Tid; Tail() zodb.Tid }, lo, hi zodb.Tid) {
tail := δ.Tail()
head := δ.Head()
if !(tail <= lo && lo <= hi && hi <= head) {
panicf("invalid slice: (%s, %s]; (tail, head] = (%s, %s]", lo, hi, tail, head)
}
}
......@@ -155,15 +155,16 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
panic("TODO")
}
// XXX SliceByRev
// XXX
func (δFtail *ΔFtail) SliceByRev(lo, hi zodb.Tid) /*readonly*/ []ΔF {
δassertSlice(δFtail, lo, hi)
// XXX SliceByFileRev
panic("TODO")
}
// XXX
func (δFtail *ΔFtail) SliceByFileRev(f *BigFile, lo, hi zodb.Tid) /*readonly*/[]Δfile {
tail := δFtail.Tail()
head := δFtail.Head()
if !(tail <= lo && lo <= hi && hi <= head) {
panicf("δFtail.SliceByFileRev: invalid query: (%s, %s]; (tail, head] = (%s, %s]", lo, hi, tail, head)
}
δassertSlice(δFtail, lo, hi)
// XXX activate zfile?
vδT := δFtail.δBtail.SliceByRootRev(f.zfile.blktab, lo, hi)
......
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