Commit 8456cefd authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8be186ba
...@@ -82,7 +82,9 @@ type Value = zodb.Oid // XXX assumes key points to IPersistent ...@@ -82,7 +82,9 @@ type Value = zodb.Oid // XXX assumes key points to IPersistent
// ΔBTail is not safe for concurrent access. // ΔBTail is not safe for concurrent access.
// XXX -> multiple readers / single writer? // XXX -> multiple readers / single writer?
type ΔBtail struct { type ΔBtail struct {
δZtail *zodb.ΔTail // raw ZODB changes; Kept to rebuild δBtail/byRoot after new Track // raw ZODB changes; Kept to rebuild δBtail/byRoot after new Track.
// includes all changed objects, not only tracked ones.
δZtail *zodb.ΔTail
δRtail []Δ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
...@@ -151,16 +153,9 @@ func newΔTtail() *ΔTreeTail { ...@@ -151,16 +153,9 @@ func newΔTtail() *ΔTreeTail {
} }
} }
// Head is similar to zodb.ΔTail.Head . XXX ok? // (tail, head] coverage
func (δBtail *ΔBtail) Head() zodb.Tid { func (δBtail *ΔBtail) Head() zodb.Tid { return δBtail.δZtail.Head() }
//return δb.head func (δBtail *ΔBtail) Tail() zodb.Tid { return δBtail.δZtail.Tail() }
return δBtail.δZtail.Head()
}
// Tail is similar to zodb.ΔTail.Tail . XXX ok?
func (δBtail *ΔBtail) Tail() zodb.Tid {
return δBtail.δZtail.Tail()
}
// XXX SliceByRev? // XXX SliceByRev?
// XXX ForgetPast // XXX ForgetPast
...@@ -209,6 +204,8 @@ func (δBtail *ΔBtail) Track(path []Node) { // XXX Tree|Bucket; path[0] = root ...@@ -209,6 +204,8 @@ func (δBtail *ΔBtail) Track(path []Node) { // XXX Tree|Bucket; path[0] = root
// Only those objects from δZ that belong to tracked set are guaranteed to be // Only those objects from δZ that belong to tracked set are guaranteed to be
// taken into account. In other words a tree history will assuredly include // taken into account. In other words a tree history will assuredly include
// only those keys, that correspond to tracked subset of δZ. // 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) Δ {
δBtail.δZtail.Append(δZ.Tid, δZ.Changev) δBtail.δZtail.Append(δZ.Tid, δZ.Changev)
......
...@@ -83,9 +83,9 @@ func NewΔFtail(at0 zodb.Tid) *ΔFtail { ...@@ -83,9 +83,9 @@ func NewΔFtail(at0 zodb.Tid) *ΔFtail {
} }
} }
// XXX // (tail, head] coverage
func (δFtail *ΔFtail) Head() zodb.Tid { panic("TODO") } func (δFtail *ΔFtail) Head() zodb.Tid { return δFtail.δBtail.Head() }
func (δFtail *ΔFtail) Tail() zodb.Tid { panic("TODO") } func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
// Track adds tree path to tracked set and associates path root with file. // Track adds tree path to tracked set and associates path root with file.
...@@ -117,6 +117,8 @@ func (δFtail *ΔFtail) Track(file *BigFile, path []btree.LONode) { ...@@ -117,6 +117,8 @@ func (δFtail *ΔFtail) Track(file *BigFile, path []btree.LONode) {
// Update updates δFtail given raw ZODB changes. // Update updates δFtail given raw ZODB changes.
// //
// It returns change in files space that corresponds to δZ. // It returns change in files space that corresponds to δZ.
//
// δZ should include all objects changed by ZODB transaction.
func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) ΔF { func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit) ΔF {
δB := δFtail.δBtail.Update(δZ) δB := δFtail.δBtail.Update(δZ)
δF := ΔF{Rev: δB.Rev, Change: make(map[*BigFile]SetI64)} δF := ΔF{Rev: δB.Rev, Change: make(map[*BigFile]SetI64)}
......
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