Commit 67a29ab6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 873e336e
......@@ -83,7 +83,7 @@ type ΔTail struct {
// XXX -> δZtail
ΔZtail *zodb.ΔTail // raw ZODB changes; Kept to rebuild δBtail/byRoot after new Track
// δroot []ΔRoots // which BTree were changed; Noted only by keys ∈ tracket subset
δRtail []ΔRoots // which BTree were changed; Noted only by keys ∈ tracket subset
byRoot map[*Tree]*ΔTreeTail // root -> k/v change history; only for keys ∈ tracket subset
// XXX or ask client provide db on every call?
......@@ -102,21 +102,17 @@ type Δ struct {
Change map[*Tree]map[Key]Value // {} root -> {}(key, value)
}
/*
// ΔRoots describes which BTrees were change in one revision.
// XXX kill?
type ΔRoots struct {
Rev zodb.Tid
Changev []*Tree // root XXX -> Oid? XXX -> SetTree?
}
*/
// ΔTreeTail represent tail of revisional changes to one BTree.
//
// See ΔTail documentation for details.
type ΔTreeTail struct {
δTtail []ΔTree // changes to tree keys; rev↑. covers keys ∈ tracket subset
vδT []ΔTree // changes to tree keys; rev↑. covers keys ∈ tracket subset
// {}k/v @tail for keys that are changed in (tail, head].
KVAtTail map[Key]Value
......@@ -128,7 +124,7 @@ type ΔTreeTail struct {
// ΔTree describes changes to one BTree in one revision.
type ΔTree struct {
Rev zodb.Tid
Root *Tree // XXX ok to have here?
// Root *Tree // XXX ok to have here?
KV map[Key]Value
}
......@@ -271,15 +267,15 @@ func (δΒtail *ΔTail) Get(root *Tree, key Key, at zodb.Tid) (value Value, ok b
// XXX stub -> that only ZBlk.rev is used
// XXX -> index lastXXXOf(key) | linear scan ↓ looking for change <= at
δt := δΒtail.byRoot[root]
for i := len(δt.δTtail)-1; i >= 0; i-- {
δ := δt.δTtail[i]
if at < δ.Rev {
δTtail := δΒtail.byRoot[root]
for i := len(δTtail.vδT)-1; i >= 0; i-- {
δT := δTtail.vδT[i]
if at < δT.Rev {
continue
}
value, ok = δ.KV[key]
value, ok = δT.KV[key]
if ok {
rev = δ.Rev
rev = δT.Rev
revExact = true
break
}
......@@ -291,7 +287,7 @@ func (δΒtail *ΔTail) Get(root *Tree, key Key, at zodb.Tid) (value Value, ok b
}
// key not in history tail
value, ok = δt.KVAtTail[key]
value, ok = δTtail.KVAtTail[key]
rev = δΒtail.Tail()
revExact = false
return
......
......@@ -408,6 +408,7 @@ package main
//
// δZ - change in ZODB space
// δB - change in BTree*s* space
// δT - change in BTree(1) space
// δF - change in File*s* space
// δfile - change in File(1) space
......
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