src/server/pkg/hashtree/cache.go
func (c *MergeCache) Merge(w *Writer, base io.Reader, filter Filter) (retErr error) {
	var trees []*Reader
	if base != nil {
		trees = append(trees, NewReader(base, filter))
	}
	for _, key := range c.Keys() {
		r, err := c.Cache.Get(key)
		if err != nil {
			return err
		}
		defer func() {
			if err := r.Close(); err != nil && retErr == nil {
				retErr = err
			}
		}()
		trees = append(trees, NewReader(r, filter))
	}
	return Merge(w, trees)
}
func (c *MergeCache) Merge(w *Writer, base io.Reader, filter Filter) (retErr error) {
	var trees []*Reader
	if base != nil {
		trees = append(trees, NewReader(base, filter))
	}
	for _, key := range c.Keys() {
		r, err := c.Cache.Get(key)
		if err != nil {
			return err
		}
		defer func() {
			if err := r.Close(); err != nil && retErr == nil {
				retErr = err
			}
		}()
		trees = append(trees, NewReader(r, filter))
	}
	return Merge(w, trees)
}
// Merge does a filtered merge of the hashtrees in the cache.
// The results are written to the passed in *Writer.
// The base field is used as the base hashtree if it is non-nil