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

.

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