Commit 713e5439 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a8a50795
...@@ -156,7 +156,7 @@ func opPut(written bool) treeOp { ...@@ -156,7 +156,7 @@ func opPut(written bool) treeOp {
} }
// checkHit rescans t from root and checks that hit D, P, Kmin/Kmax and rest all match what they should // checkHit rescans t from root and checks that hit D, P, Kmin/Kmax and rest all match what they should
// it can be used after Set/Put/Delete to verify consistency // it can be used after Set/Put/Delete to verify that all hit parameters were calculated correctly
func (t *Tree) checkHit(k interface{} /*K*/, op treeOp) { func (t *Tree) checkHit(k interface{} /*K*/, op treeOp) {
wrong := false wrong := false
bad := func(s string, va ...interface{}) { bad := func(s string, va ...interface{}) {
......
...@@ -309,7 +309,7 @@ func (t *Tree) catX(p, q, r *x, pi int) { ...@@ -309,7 +309,7 @@ func (t *Tree) catX(p, q, r *x, pi int) {
// true. // true.
func (t *Tree) Delete(k interface{} /*K*/) (ok bool) { func (t *Tree) Delete(k interface{} /*K*/) (ok bool) {
//dbg("--- PRE Delete(%v)\t; %v @%d, [%v, %v) pk: [%v, %v)\n%s", k, t.hitD, t.hitDi, t.hitKmin, t.hitKmax, t.hitPKmin, t.hitPKmax, t.dump()) //dbg("--- PRE Delete(%v)\t; %v @%d, [%v, %v) pk: [%v, %v)\n%s", k, t.hitD, t.hitDi, t.hitKmin, t.hitKmax, t.hitPKmin, t.hitPKmax, t.dump())
defer t.checkHit(k, opDel) //defer t.checkHit(k, opDel)
//defer func() { //defer func() {
// dbg("--- POST\n%s\n====\n", t.dump()) // dbg("--- POST\n%s\n====\n", t.dump())
//}() //}()
...@@ -712,7 +712,7 @@ func (t *Tree) SeekLast() (e *Enumerator, err error) { ...@@ -712,7 +712,7 @@ func (t *Tree) SeekLast() (e *Enumerator, err error) {
// Set sets the value associated with k. // Set sets the value associated with k.
func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) { func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
//dbg("--- PRE Set(%v, %v)\t; %v @%d, [%v, %v) pk: [%v, %v)\n%s", k, v, t.hitD, t.hitDi, t.hitKmin, t.hitKmax, t.hitPKmin, t.hitPKmax, t.dump()) //dbg("--- PRE Set(%v, %v)\t; %v @%d, [%v, %v) pk: [%v, %v)\n%s", k, v, t.hitD, t.hitDi, t.hitKmin, t.hitKmax, t.hitPKmin, t.hitPKmax, t.dump())
defer t.checkHit(k, opSet) //defer t.checkHit(k, opSet)
//defer func() { //defer func() {
// dbg("--- POST\n%s\n====\n", t.dump()) // dbg("--- POST\n%s\n====\n", t.dump())
//}() //}()
...@@ -824,7 +824,7 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) { ...@@ -824,7 +824,7 @@ func (t *Tree) Set(k interface{} /*K*/, v interface{} /*V*/) {
// //
// modulo the differing return values. // modulo the differing return values.
func (t *Tree) Put(k interface{} /*K*/, upd func(oldV interface{} /*V*/, exists bool) (newV interface{} /*V*/, write bool)) (oldV interface{} /*V*/, written bool) { func (t *Tree) Put(k interface{} /*K*/, upd func(oldV interface{} /*V*/, exists bool) (newV interface{} /*V*/, write bool)) (oldV interface{} /*V*/, written bool) {
defer func () { t.checkHit(k, opPut(written)) }() //defer func () { t.checkHit(k, opPut(written)) }()
pi := -1 pi := -1
var p *x var p *x
q := t.r q := t.r
......
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