in hashring/rbtree.go [267:293]
func (n *redBlackNode) traverseWhile(condition func(*redBlackNode) bool) bool {
if n == nil {
// the end of the tree does not signal the end of walking, but we can't
// walk this node (nil) nor left or right anymore
return true
}
// walk left first
if !n.left.traverseWhile(condition) {
// stop if walker indicated to break
return false
}
// now visit this node
if !condition(n) {
// stop if walker indicated to break
return false
}
// lastly visit right
if !n.right.traverseWhile(condition) {
// stop if walker indicated to break
return false
}
// signal that we reached the end and walking should continue till we hit
// end of tree
return true
}