func (f *MemFile) WriteVec(datav [][]byte) (int, error) {
	f.mtx.Lock()
	defer f.mtx.Unlock()
	wrote, err := f.writeVecAt(datav, f.offset)
	f.offset += int64(wrote)
	return wrote, err
}
WriteVec writes a vector of byte slices starting at the current offset
package redisfs
import (
	"errors"
	"io"
	"os"
	"sync"
)
var (
	ErrNegativeOffset = errors.New("Negative offset")
	ErrNegativeTruncateSize = errors.New("Negative truncate size")
	ErrInvalidSeekWhence = errors.New("Seek whence is not a proper value")
	ErrNegativeSeekLocation = errors.New("Seek location (from offset and whence) is negative")
)
type MemFile struct {
	store  *DataStore
	path   string
	offset int64
	mtx    *sync.RWMutex
}
func NewMemFile(store *DataStore, path string, mtx *sync.RWMutex) *MemFile {
	return &MemFile{
		store: store,
		path:  path,
		mtx:   mtx,
	}
}
func (f MemFile) Name() string {
	return f.path
}
func (f MemFile) Size() int64 {
	return f.store.GetSize(f.path)
}
func (f MemFile) Sync() error {
	return nil
}
func (f MemFile) Truncate(size int64) error {
	if size < 0 {
		return ErrNegativeTruncateSize
	}
	f.mtx.Lock()
	defer f.mtx.Unlock()
	f.store.Resize(f.path, size)
	return nil
}
func (f MemFile) Close() error {
	return nil
}
func (f MemFile) readAt(dst []byte, off int64) (int, error) {
	if off < 0 {
		panic(ErrNegativeOffset)
	}
	if len(dst) == 0 {
		return 0, nil
	}
	n := int(f.store.ReadAt(f.path, off, dst))
	if n < len(dst) {
		return n, io.EOF
	}
	return n, nil
}
func (f *MemFile) Read(dst []byte) (int, error) {
	f.mtx.RLock()  
	defer f.mtx.RUnlock()
	read, err := f.readAt(dst, f.offset)
	f.offset += int64(read)
	return read, err
}
func (f MemFile) ReadAt(dst []byte, off int64) (int, error) {
	f.mtx.RLock()
	defer f.mtx.RUnlock()
	return f.readAt(dst, off)
}
func (f MemFile) readVecAt(dstv [][]byte, off int64) (int, error) {
	var n int
	for _, dst := range dstv {
		read, err := f.readAt(dst, off)
		n += read
		if err != nil {
			if err == io.EOF {
				return n, io.EOF
			}
			panic(err)
		}
		off += int64(read)
	}
	return n, nil
}
func (f *MemFile) ReadVec(dstv [][]byte) (int, error) {
	f.mtx.RLock()  
	defer f.mtx.RUnlock()
	read, err := f.readVecAt(dstv, f.offset)
	f.offset += int64(read)
	return read, err
}
func (f MemFile) ReadVecAt(dstv [][]byte, off int64) (int, error) {
	f.mtx.RLock()
	defer f.mtx.RUnlock()
	return f.readVecAt(dstv, off)
}
func (f MemFile) writeAt(data []byte, off int64) (int, error) {
	if off < 0 {
		panic(ErrNegativeOffset)
	}
	f.store.WriteAt(f.path, off, data)
	return len(data), nil
}
func (f *MemFile) Write(data []byte) (int, error) {
	f.mtx.Lock()
	defer f.mtx.Unlock()
	wrote, err := f.writeAt(data, f.offset)
	f.offset += int64(wrote)
	return wrote, err
}
func (f MemFile) WriteAt(data []byte, off int64) (int, error) {
	f.mtx.Lock()
	defer f.mtx.Unlock()
	return f.writeAt(data, off)
}
func (f MemFile) writeVecAt(datav [][]byte, off int64) (int, error) {
	var n int
	for _, data := range datav {
		wrote, _ := f.writeAt(data, off)
		off += int64(wrote)
		n += wrote
	}
	return n, nil
}