func (store *defaultGroupStore) newGroupReadFile(nameTimestamp int64) (*groupStoreFile, error) {
	fl := &groupStoreFile{store: store, nameTimestamp: nameTimestamp}
	fl.fullPath = path.Join(store.path, fmt.Sprintf("%019d.group", fl.nameTimestamp))
	fl.readerFPs = make([]brimio.ChecksummedReader, store.fileReaders)
	fl.readerLocks = make([]sync.Mutex, len(fl.readerFPs))
	fl.readerLens = make([][]byte, len(fl.readerFPs))
	var checksumInterval uint32
	for i := 0; i < len(fl.readerFPs); i++ {
		fp, err := store.openReadSeeker(fl.fullPath)
		if err != nil {
			return nil, err
		}
		if i == 0 {
			if _, checksumInterval, err = readGroupHeader(fp); err != nil {
				return nil, err
			}
		}
		fl.readerFPs[i] = brimio.NewChecksummedReader(fp, int(checksumInterval), murmur3.New32)
		fl.readerLens[i] = make([]byte, 4)
	}
	var err error
	fl.id, err = store.addLocBlock(fl)
	if err != nil {
		fl.close()
		return nil, err
	}
	return fl, nil
}
func (store *defaultGroupStore) createGroupReadWriteFile() (*groupStoreFile, error) {
	fl := &groupStoreFile{store: store, nameTimestamp: time.Now().UnixNano()}
	fl.fullPath = path.Join(store.path, fmt.Sprintf("%019d.group", fl.nameTimestamp))
	fp, err := store.createWriteCloser(fl.fullPath)
	if err != nil {
		return nil, err
	}
	fl.writerFP = fp
	fl.writerFreeBufChan = make(chan *groupStoreFileWriteBuf, store.workers)
	for i := 0; i < store.workers; i++ {
		fl.writerFreeBufChan <- &groupStoreFileWriteBuf{buf: make([]byte, store.checksumInterval+4)}
	}
	fl.writerChecksumBufChan = make(chan *groupStoreFileWriteBuf, store.workers)
	fl.writerToDiskBufChan = make(chan *groupStoreFileWriteBuf, store.workers)
	fl.writerDoneChan = make(chan struct{})
	fl.writerCurrentBuf = <-fl.writerFreeBufChan
	head := []byte("GROUPSTORE v0                   ")
	binary.BigEndian.PutUint32(head[28:], store.checksumInterval)
	fl.writerCurrentBuf.offset = uint32(copy(fl.writerCurrentBuf.buf, head))
	atomic.StoreUint32(&fl.writerOffset, fl.writerCurrentBuf.offset)
	go fl.writer()
	for i := 0; i < store.workers; i++ {
		go fl.writingChecksummer()
	}
	fl.readerFPs = make([]brimio.ChecksummedReader, store.fileReaders)
	fl.readerLocks = make([]sync.Mutex, len(fl.readerFPs))
	fl.readerLens = make([][]byte, len(fl.readerFPs))
	for i := 0; i < len(fl.readerFPs); i++ {
		fp, err := store.openReadSeeker(fl.fullPath)
		if err != nil {
			fl.writerFP.Close()
			for j := 0; j < i; j++ {
				fl.readerFPs[j].Close()
			}
			return nil, err
		}
		fl.readerFPs[i] = brimio.NewChecksummedReader(fp, int(store.checksumInterval), murmur3.New32)
		fl.readerLens[i] = make([]byte, 4)
	}
	fl.id, err = store.addLocBlock(fl)
	if err != nil {
		return nil, err
	}
	return fl, nil
}