Commit 2370caa6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 5b30965f
......@@ -73,6 +73,7 @@ func (M *RangedMap) Has(k Key) bool {
// Get_ is comma-ok version of Get.
func (M *RangedMap) Get_(k Key) (v VALUE, r KeyRange, ok bool) {
r = KeyRange{0,-1} // zero value represents non-empty [0,1)
if traceRangeMap {
fmt.Printf("\n\nGet_:\n")
fmt.Printf(" M: %s\n", M)
......
......@@ -75,6 +75,7 @@ func (M *_RangedMap_str) Has(k Key) bool {
// Get_ is comma-ok version of Get.
func (M *_RangedMap_str) Get_(k Key) (v string, r KeyRange, ok bool) {
r = KeyRange{0,-1} // zero value represents non-empty [0,1)
if trace_RangedMap_str {
fmt.Printf("\n\nGet_:\n")
fmt.Printf(" M: %s\n", M)
......
......@@ -75,6 +75,7 @@ func (M *_RangedMap_void) Has(k Key) bool {
// Get_ is comma-ok version of Get.
func (M *_RangedMap_void) Get_(k Key) (v void, r KeyRange, ok bool) {
r = KeyRange{0,-1} // zero value represents non-empty [0,1)
if trace_RangedMap_void {
fmt.Printf("\n\nGet_:\n")
fmt.Printf(" M: %s\n", M)
......
......@@ -51,9 +51,11 @@ type _RangedMap_RebuildJobEntry struct {
// Get returns value associated with key k.
func (M *_RangedMap_RebuildJob) Get(k Key) *_RebuildJob {
v, _ := M.Get_(k)
return v
//
// blib.KeyRange indicates all keys adjacent to k, that are too mapped to the same value.
func (M *_RangedMap_RebuildJob) Get(k Key) (*_RebuildJob, blib.KeyRange) {
v, r, _ := M.Get_(k)
return v, r
}
// Set changes M to map key k to value v.
......@@ -68,20 +70,21 @@ func (M *_RangedMap_RebuildJob) Del(k Key) {
// Has returns whether key k is present in the map.
func (M *_RangedMap_RebuildJob) Has(k Key) bool {
_, ok := M.Get_(k)
_, _, ok := M.Get_(k)
return ok
}
// Get_ is comma-ok version of Get.
func (M *_RangedMap_RebuildJob) Get_(k Key) (v *_RebuildJob, ok bool) {
func (M *_RangedMap_RebuildJob) Get_(k Key) (v *_RebuildJob, r blib.KeyRange, ok bool) {
r = blib.KeyRange{0,-1} // zero value represents non-empty [0,1)
if trace_RangedMap_RebuildJob {
fmt.Printf("\n\nGet_:\n")
fmt.Printf(" M: %s\n", M)
fmt.Printf(" k: %s\n", blib.KStr(k))
defer func() {
fmt.Printf("->·: %v, %t\n", v, ok)
fmt.Printf("->·: %v%s, %t\n", v, r, ok)
}()
}
......@@ -104,7 +107,7 @@ func (M *_RangedMap_RebuildJob) Get_(k Key) (v *_RebuildJob, ok bool) {
}
// found
return e.Value, true
return e.Value, e.KeyRange, true
}
// SetRange changes M to map key range r to value v.
......
......@@ -489,7 +489,7 @@ func (δBtail *ΔBtail) vδTSnapForTrackedKey(root zodb.Oid, key Key) (vδT []Δ
if !δTtail.ktrackNew.Has(key) {
// key ∉ ktrackNew
job, inJobs := δTtail.krebuildJobs.Get_(key)
job, _, inJobs := δTtail.krebuildJobs.Get_(key)
if !inJobs {
// key ∉ krebuildJobs -> it should be already in trackSet
vδT = δTtail.vδT
......@@ -608,7 +608,7 @@ func (δTtail *_ΔTtail) __rebuild(root zodb.Oid, δBtail *ΔBtail, releaseLock
// krebuildJobs -= ktrackNew
for _, r := range ktrackNew.AllRanges() {
// assert krebuildJobs[r] = job
job_, r_ := δTtail.krebuildJobs.Get_(r.Lo)
job_, r_ := δTtail.krebuildJobs.Get(r.Lo)
if !(job_ == job && r_ == r) {
panicf("BUG: rebuild: epilogue: " +
"krebuildJobs entry mutated:\nset in prologue [%s]=%p\ngot in epilogue: [%s]=%p",
......
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