Commit 94a14ccd authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 568f054f
......@@ -538,8 +538,18 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
// Leaf is usually bucket node, but, in the sole single case of empty tree, can be that root tree node.
// GetToLeaf expands step-by-step every tree through which it has to traverse to next depth level.
//
// GetToLeaf panics if k is not covered.
// XXX also return path?
func (prs *rangeSplit) GetToLeaf(ctx context.Context, k Key) (rnode *nodeInRange, ok bool, err error) {
func (prs *rangeSplit) GetToLeaf(ctx context.Context, k Key) (*nodeInRange, error) {
rnode, ok, err := prs.GetToLeaf_(ctx, k)
if err == nil && !ok {
panicf("key %v not covered; coverage: %s", k, *prs)
}
return rnode, err
}
// GetToLeaf_ is comma-ok version of GetToLeaf.
func (prs *rangeSplit) GetToLeaf_(ctx context.Context, k Key) (rnode *nodeInRange, ok bool, err error) {
rnode, ok = prs.Get_(k)
if !ok {
return nil, false, nil // key not covered
......@@ -561,7 +571,7 @@ func (prs *rangeSplit) GetToLeaf(ctx context.Context, k Key) (rnode *nodeInRange
defer tree.PDeactivate()
// empty tree -> don't expand - it is already leaf
if len(tree.Entryv()) == 0{
if len(tree.Entryv()) == 0 {
return rnode, true, nil
}
......
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