func Merge(w *Writer, rs []*Reader) error {
	if len(rs) == 0 {
		return nil
	}
	mq := &mergePQ{q: make([]*nodeStream, len(rs)+1)}
	// Setup first set of nodes
	for _, r := range rs {
		if err := mq.insert(&nodeStream{r: r}); err != nil {
			return err
		}
	}
	for mq.q[1] != nil {
		// Get next nodes to merge
		ns, err := mq.next()
		if err != nil {
			return err
		}
		// Merge nodes
		n, err := merge(ns)
		if err != nil {
			return err
		}
		// Write out result
		if err := w.Write(n); err != nil {
			return err
		}
	}
	return nil
}
func Merge(w *Writer, rs []*Reader) error {
	if len(rs) == 0 {
		return nil
	}
	mq := &mergePQ{q: make([]*nodeStream, len(rs)+1)}
	
	for _, r := range rs {
		if err := mq.insert(&nodeStream{r: r}); err != nil {
			return err
		}
	}
	for mq.q[1] != nil {
		
		ns, err := mq.next()
		if err != nil {
			return err
		}
		
		n, err := merge(ns)
		if err != nil {
			return err
		}
		
		if err := w.Write(n); err != nil {
			return err
		}
	}
	return nil
}
func Merge ( w * Writer , rs [ ] * Reader ) error { if len ( rs ) == 0 { return nil } mq := & mergePQ { q : make ( [ ] * nodeStream , len ( rs ) + 1 ) } // Setup first set of nodes for _ , r := range rs { if err := mq . insert ( & nodeStream { r : r } ) ; err != nil { return err } } for mq . q [ 1 ] != nil { // Get next nodes to merge ns , err := mq . next ( ) if err != nil { return err } // Merge nodes n , err := merge ( ns ) if err != nil { return err } // Write out result if err := w . Write ( n ) ; err != nil { return err } } return nil }
// Merge merges a collection of hashtree readers into a hashtree writer.
Merge merges a collection of hashtree readers into a hashtree writer .