func (b *Batch) Reset() {
	b.buf = b.buf[:0]
	b.writes = 0
	b.created = clock.Now()
}
Reset clears the Batch so that it no longer holds data.
package batch
import (
	"io"
	"time"
)
const maxReadSize = 65536
func New(capacity int) *Batch {
	return &Batch{
		buf:     make([]byte, 0, capacity),
		created: clock.Now(),
	}
}
type Batch struct {
	buf     []byte
	writes  int
	created time.Time
}
func (b *Batch) Size() int {
	return len(b.buf)
}
func (b *Batch) Remaining() int {
	return cap(b.buf) - len(b.buf)
}
func (b *Batch) Bytes() []byte {
	return b.buf
}
func (b *Batch) CopyBytes() []byte {
	out := make([]byte, len(b.buf))
	copy(out, b.buf)
	return out
}
func (b *Batch) Writes() int {
	return b.writes
}
func (b *Batch) Age() time.Duration {
	if b.writes <= 0 {
		return time.Duration(0)
	}
	return clock.Since(b.created)
}