func (logBuffers *LogBuffers) Buffer(index int) *atomic.Buffer {
	return &logBuffers.buffers[index]
}
Buffer returns a buffer backing a specific term based on index. PartitionLength+1 is the size of the buffer array,
and the last buffer is the metadata buffer, which can be accessed through a convenience wrapped via Meta() method.
package logbuffer
import (
	"github.com/lirm/aeron-go/aeron/atomic"
	"github.com/lirm/aeron-go/aeron/util/memmap"
	"github.com/op/go-logging"
	"unsafe"
)
var logger = logging.MustGetLogger("logbuffers")
type LogBuffers struct {
	mmapFiles []*memmap.File
	buffers   [PartitionCount + 1]atomic.Buffer
	meta      LogBufferMetaData
}
func Wrap(fileName string) *LogBuffers {
	buffers := new(LogBuffers)
	logLength := memmap.GetFileSize(fileName)
	termLength := computeTermLength(int32(logLength))
	checkTermLength(termLength)
	if logLength < maxSingleMappingSize {
		mmap, err := memmap.MapExisting(fileName, 0, 0)
		if err != nil {
			panic(err)
		}
		buffers.mmapFiles = []*memmap.File{mmap}
		basePtr := uintptr(mmap.GetMemoryPtr())
		for i := 0; i < PartitionCount; i++ {
			ptr := unsafe.Pointer(basePtr + uintptr(int64(i)*int64(termLength)))
			buffers.buffers[i].Wrap(ptr, int32(termLength))
		}
		ptr := unsafe.Pointer(basePtr + uintptr(logLength-int64(LogMetaDataLength)))
		buffers.buffers[LogMetaDataSectionIndex].Wrap(ptr, LogMetaDataLength)
		buffers.meta.Wrap(&buffers.buffers[LogMetaDataSectionIndex], 0)
	} else {
		buffers.mmapFiles = make([]*memmap.File, PartitionCount+1)
		metaDataSectionOffset := int64(termLength) * int64(LogMetaDataSectionIndex)
		metaDataSectionLength := int(logLength - metaDataSectionOffset)
		mmap, err := memmap.MapExisting(fileName, metaDataSectionOffset, metaDataSectionLength)
		if err != nil {
			panic("Failed to map the log buffer")
		}
		buffers.mmapFiles = append(buffers.mmapFiles, mmap)
		for i := 0; i < PartitionCount; i++ {
			mmap, err := memmap.MapExisting(fileName, int64(i)*int64(termLength), int(termLength))
			if err != nil {
				panic("Failed to map the log buffer")
			}
			buffers.mmapFiles = append(buffers.mmapFiles, mmap)
			basePtr := buffers.mmapFiles[i+1].GetMemoryPtr()
			buffers.buffers[i].Wrap(basePtr, int32(termLength))
		}
		metaDataBasePtr := buffers.mmapFiles[0].GetMemoryPtr()
		buffers.buffers[LogMetaDataSectionIndex].Wrap(metaDataBasePtr, LogMetaDataLength)
		buffers.meta.Wrap(&buffers.buffers[PartitionCount], 0)
	}
	return buffers
}
func (logBuffers *LogBuffers) Meta() *LogBufferMetaData {
	return &logBuffers.meta
}