Commit 8adc4356 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent eac5d619
...@@ -294,6 +294,7 @@ func (δBtail *ΔBtail) Tail() zodb.Tid { return δBtail.δZtail.Tail() } ...@@ -294,6 +294,7 @@ func (δBtail *ΔBtail) Tail() zodb.Tid { return δBtail.δZtail.Tail() }
// XXX path -> []oid ? // XXX path -> []oid ?
// //
// XXX catch cycles on add? // XXX catch cycles on add?
/*
type TrackFlags int type TrackFlags int
const ( const (
// TrackMaxKey // TrackMaxKey
...@@ -303,7 +304,9 @@ const ( ...@@ -303,7 +304,9 @@ const (
// XXX TrackMinKey (we don't need it in WCFS) // XXX TrackMinKey (we don't need it in WCFS)
) )
func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags TrackFlags) error { // XXX Tree|Bucket; path[0] = root */
//func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags TrackFlags) error { // XXX Tree|Bucket; path[0] = root
func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { // XXX Tree|Bucket; path[0] = root
l := len(path) l := len(path)
if l == 0 { if l == 0 {
panic("empty path") panic("empty path")
......
...@@ -458,24 +458,15 @@ func xverifyΔBTail(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, a ...@@ -458,24 +458,15 @@ func xverifyΔBTail(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, a
adj1 := SetKey{} adj1 := SetKey{}
adj2 := SetKey{} adj2 := SetKey{}
k1 := k q1 := []Key{k}
k2 := k q2 := []Key{k}
/*
if k == kInf { // XXX not needed? - kill?
k1 = maxk1
k2 = maxk2
}
*/
q1 := []Key{k1}
q2 := []Key{k2}
//tracef("\n") //tracef("\n")
for len(q1) > 0 || len(q2) > 0 { for len(q1) > 0 || len(q2) > 0 {
//tracef("q1: %v\n", q1) //tracef("q1: %v\n", q1)
//tracef("q2: %v\n", q2) //tracef("q2: %v\n", q2)
if l1 := len(q1); l1 > 0 { if l1 := len(q1); l1 > 0 {
k1 = q1[l1-1]; q1 = q1[:l1-1] k1 := q1[l1-1]; q1 = q1[:l1-1]
if !adj1.Has(k1) { if !adj1.Has(k1) {
for k_ := range xkv1.Get(k1).kv { for k_ := range xkv1.Get(k1).kv {
adj1.Add(k_) adj1.Add(k_)
...@@ -489,7 +480,7 @@ func xverifyΔBTail(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, a ...@@ -489,7 +480,7 @@ func xverifyΔBTail(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, a
} }
if l2 := len(q2); l2 > 0 { if l2 := len(q2); l2 > 0 {
k2 = q2[l2-1]; q2 = q2[:l2-1] k2 := q2[l2-1]; q2 = q2[:l2-1]
if !adj2.Has(k2) { if !adj2.Has(k2) {
for k_ := range xkv2.Get(k2).kv { for k_ := range xkv2.Get(k2).kv {
adj2.Add(k_) adj2.Add(k_)
...@@ -571,11 +562,8 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, ...@@ -571,11 +562,8 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
}); X(err) }); X(err)
// kInf imitates ZBigFile.Size() request, which enables maxkey tracking. // kInf imitates ZBigFile.Size() request, which enables maxkey tracking.
trackFlags := TrackFlags(0) // XXX ^^^ comment place = ?
if k == kInf { err = δbtail.Track(k, ok, path); X(err)
trackFlags = TrackMaxKey
}
err = δbtail.Track(k, ok, path, trackFlags); X(err)
kadjTracked.Update(kadj[k]) kadjTracked.Update(kadj[k])
} }
......
...@@ -137,12 +137,11 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() } ...@@ -137,12 +137,11 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
// //
// A root can be associated with several files (each provided on different Track call). // A root can be associated with several files (each provided on different Track call).
func (δFtail *ΔFtail) Track(file *BigFile, blk int64, path []btree.LONode, zblk zBlk) { func (δFtail *ΔFtail) Track(file *BigFile, blk int64, path []btree.LONode, zblk zBlk) {
δbTrackFlags := TrackFlags(0)
if blk == -1 { if blk == -1 {
// XXX blk = ∞ ? // XXX blk = ∞ from beginning ?
δbTrackFlags = TrackMaxKey blk = KeyMax
} }
err := δFtail.δBtail.Track(blk, zblk != nil, path, δbTrackFlags) err := δFtail.δBtail.Track(blk, zblk != nil, path)
if err != nil { if err != nil {
panic(err) // XXX -> error? errctx panic(err) // XXX -> error? errctx
} }
......
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