func SortEntries(c sstable.Cursor, maxSize uint64, w *sstable.Writer) (n int, err error) {
	es, size := Entries{}, uint64(0)
	for !c.Done() && size < maxSize {
		e := c.Entry()
		c.Next()
		size += e.Size()
		es = append(es, HeapEntry{*e, nil})
	}
	heap.Init(&es)
	for es.Len() > 0 {
		e := heap.Pop(&es)
		err = w.Write(e.(HeapEntry).Entry)
		if err != nil {
			return n, err
		}
		n++
	}
	return n, w.Close()
}
SortEntries sorts entries from c in memory and write to w in
slightly over the maxSize bytes. Returns number of entries written
and error.
nolint:golint
package sort
import (
	"container/heap"
	"github.com/jaeyeom/sstable/go/sstable"
)