func (bt *Tree) Walk(ctx int64, fn func(key []byte, data []encoding.Sequence) (more bool, keep bool, err error)) error {
	nodes := make([]*node, 0, bt.length)
	nodes = append(nodes, bt.root)
	for {
		if len(nodes) == 0 {
			break
		}
		n := nodes[0]
		nodes = nodes[1:]
		if n.data != nil {
			alreadyRemoved := n.wasRemovedFor(bt, ctx)
			if !alreadyRemoved {
				more, keep, err := fn(n.key, n.data)
				if !keep {
					n.doRemoveFor(bt, ctx)
				}
				if !more || err != nil {
					return err
				}
			}
		}
		for _, e := range n.edges {
			nodes = append(nodes, e.target)
		}
	}
	return nil
}
Walk walks this Tree, calling the given fn with each node's key and data. If
the fn returns false, the node will be removed from the Tree as viewed with
the given ctx. Subsequent walks of the Tree using that same ctx will not see
removed nodes, but walks using a different context will still see them.
package bytetree
import (
	"sync"
	"time"
	"github.com/getlantern/bytemap"
	"github.com/getlantern/zenodb/encoding"
	"github.com/getlantern/zenodb/expr"
)
type Tree struct {
	outExprs      []expr.Expr
	inExprs       []expr.Expr
	subMergers    [][]expr.SubMerge
	outResolution time.Duration
	inResolution  time.Duration
	asOf          time.Time
	until         time.Time
	strideSlice   time.Duration
	root          *node
	bytes         int
	length        int
	mx            sync.RWMutex
}
type node struct {
	key        []byte
	edges      edges
	data       []encoding.Sequence
	removedFor []int64
}
type edge struct {
	label  []byte
	target *node
}
func New(
	outExprs []expr.Expr,
	inExprs []expr.Expr,
	outResolution time.Duration,
	inResolution time.Duration,
	asOf time.Time,
	until time.Time,
	strideSlice time.Duration,
) *Tree {
	var subMergers [][]expr.SubMerge
	for _, o := range outExprs {
		subMergers = append(subMergers, o.SubMergers(inExprs))
	}
	return &Tree{
		outExprs:      outExprs,
		inExprs:       inExprs,
		subMergers:    subMergers,
		outResolution: outResolution,
		inResolution:  inResolution,
		asOf:          asOf,
		until:         until,
		strideSlice:   strideSlice,
		root:          &node{},
	}
}
func (bt *Tree) Bytes() int {
	return bt.bytes * 2
}
func (bt *Tree) Length() int {
	return bt.length
}