Commit 5d106a33 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 06b6d9c6
......@@ -36,6 +36,7 @@ type Bucket = btree.LOBucket
type Node = btree.LONode
type Key = int64
type Value = zodb.Oid // XXX assumes key points to IPersistent
// XXX how to represent deletion? InvalidOid?
// ΔTail represents tail of revisional changes to BTrees.
//
......@@ -98,10 +99,10 @@ type ΔRoots struct {
//
// See ΔTail documentation for details.
type ΔTreeTail struct {
δTtail []ΔTree // changes to tree keys; covers keys ∈ tracket subset
δTtail []ΔTree // changes to tree keys; rev↑. covers keys ∈ tracket subset
// {}k/v @tail for keys that are changed in (tail, head].
atTail map[*Tree]map[Key]Value
KVAtTail map[Key]Value
}
// ΔTree describes changes to one BTree in one revision.
......@@ -238,8 +239,37 @@ func (btail *ΔTail) Update(δZ *zodb.EventCommit) []ΔTree {
//
// XXX at must ∈ (tail, head] XXX [tail ?
// XXX key must be tracked?
//
// XXX -> meth of ΔTreeTail ?
func (btail *ΔTail) GetAt(root *Tree, key Key, at zodb.Tid) (value Value, ok bool, rev zodb.Tid, revExact bool) {
panic("TODO")
// XXX key not tracked -> panic
// XXX at not ∈ (tail, head] -> panic
// XXX -> index lastXXXOf(key)
δt := btail.byRoot[root]
for i := len(δt.δTtail)-1; i >= 0; i-- {
δ := δt.δTtail[i]
if at < δ.Rev {
continue
}
value, ok = δ.KV[key]
if ok {
rev = δ.Rev
revExact = true
break
}
}
// found key in history tail
if ok {
return
}
// key not in history tail
value, ok = δt.KVAtTail[key]
rev = btail.Tail()
revExact = false
return
}
func (btail *ΔTail) LastRevOf(root *Tree, key Key, at zodb.Tid) (_ zodb.Tid, exact bool) {
......
......@@ -1095,7 +1095,6 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) (err erro
}
// noone was loading - we became responsible to load this block
// blkdata, treepath, pathRevMax, err := f.zfile.LoadBlk(ctx, blk)
blkdata, treepath, zblkrev, err := f.zfile.LoadBlk(ctx, blk)
loading.blkdata = blkdata
loading.err = err
......
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