func (f frame) data() []byte {
	if len(f) < total {
		return nil
	}
	return f[total:]
}
data returns the record data stored in the frame.
It returns nil if not enough of the frame has been
read to read at least one byte of data.

The underlying array of the slice returned may be
recycled.
package buffer
import (
	"errors"
	"fmt"
	"os"
	"sync"
	"syscall"
	"github.com/ashishgandhi/buffer/binary"
)
const (
	size     = 4  
	sequence = 8  
	total    = size + sequence
	metadata = 4 << 10  
)
var maxBytes uint32 = (1 << (uint(size) * 8)) - total  
type frame []byte
var (
	errFrameTooBig = fmt.Errorf("buffer: data more than max %d bytes", maxBytes)
	errDataTooBig  = errors.New("buffer: data overflows buffer")
)
func newFrame(seq uint64, data []byte) (frame, error) {
	if len(data) > int(maxBytes) {
		return nil, errFrameTooBig
	}
	var f frame = make([]byte, len(data)+total)
	binary.PutLittleEndianUint32(f, 0, uint32(len(f)))
	binary.PutLittleEndianUint64(f, size, seq)
	copy(f[total:], data)
	return f, nil
}
func (f frame) size() uint32 {
	if len(f) < size {
		return 0
	}
	return binary.GetLittleEndianUint32(f, 0)
}
func (f frame) seq() uint64 {
	if len(f) < total {
		return 0
	}
	return binary.GetLittleEndianUint64(f, size)
}