func (i *IndexEntry) Unmarshal(data []byte) error {
	i.RaftIndex = binary.LittleEndian.Uint64(data[0:8])
	i.FilePosition = binary.LittleEndian.Uint32(data[8:12])
	return nil
}
Unmarshal decode byte into index entry
package storage
import (
	"bufio"
	"encoding/binary"
	"fmt"
	"io"
	"os"
	"path"
	"github.com/flike/kingbus/log"
)
type IndexEntry struct {
	RaftIndex    uint64
	FilePosition uint32
}
type Index struct {
	readonly  *MmapFile
	readWrite *RWFile
}
type RWFile struct {
	entries  []*IndexEntry
	writer   *bufio.Writer
	file     *os.File
	filePath string
}
const (
	IndexEntrySize = 12
)
func (i *IndexEntry) Marshal() ([]byte, error) {
	b := make([]byte, IndexEntrySize)
	binary.LittleEndian.PutUint64(b[0:8], i.RaftIndex)
	binary.LittleEndian.PutUint32(b[8:12], i.FilePosition)
	return b, nil
}