code: func (ms *FileMsgStore) readIndex(r io.Reader) (uint64, *msgIndex, error) {
  	_buf := [msgIndexRecSize]byte{}
  	buf := _buf[:]
  	if _, err := io.ReadFull(r, buf); err != nil {
  		return 0, nil, err
  	}
  	mindex := &msgIndex{}
  	seq := util.ByteOrder.Uint64(buf)
  	mindex.offset = int64(util.ByteOrder.Uint64(buf[8:]))
  	mindex.timestamp = int64(util.ByteOrder.Uint64(buf[16:]))
  	mindex.msgSize = util.ByteOrder.Uint32(buf[24:])
  	// If all zeros, return that caller should rewind (for recovery)
  	if seq == 0 && mindex.offset == 0 && mindex.timestamp == 0 && mindex.msgSize == 0 {
  		storedCRC := util.ByteOrder.Uint32(buf[msgIndexRecSize-crcSize:])
  		if storedCRC == 0 {
  			return 0, nil, errNeedRewind
  		}
  	}
  	if ms.fstore.opts.DoCRC {
  		storedCRC := util.ByteOrder.Uint32(buf[msgIndexRecSize-crcSize:])
  		crc := crc32.Checksum(buf[:msgIndexRecSize-crcSize], ms.fstore.crcTable)
  		if storedCRC != crc {
  			return 0, nil, fmt.Errorf("corrupted data, expected crc to be 0x%08x, got 0x%08x", storedCRC, crc)
  		}
  	}
  	return seq, mindex, nil
  }
docs: // readIndex reads a message index record from the given reader
  // and returns an allocated msgIndex object.