code: func (ms *FileMsgStore) lookup(seq uint64) (*pb.MsgProto, error) {
  	// Reject message for sequence outside valid range
  	if seq < ms.first || seq > ms.last {
  		return nil, nil
  	}
  	// Check first if it's in the cache.
  	msg := ms.cache.get(seq)
  	if msg == nil && ms.bufferedMsgs != nil {
  		// Possibly in bufferedMsgs
  		bm := ms.bufferedMsgs[seq]
  		if bm != nil {
  			msg = bm.msg
  			ms.cache.add(seq, msg, false)
  		}
  	}
  	// If not, we need to read it from disk...
  	if msg == nil {
  		fslice := ms.getFileSliceForSeq(seq)
  		if fslice == nil {
  			return nil, nil
  		}
  		err := ms.lockFiles(fslice)
  		if err != nil {
  			return nil, err
  		}
  		msgIndex, err := ms.readMsgIndex(fslice, seq)
  		if msgIndex != nil {
  			file := fslice.file.handle
  			// Position file to message's offset. 0 means from start.
  			_, err = file.Seek(msgIndex.offset, io.SeekStart)
  			if err == nil {
  				ms.tmpMsgBuf, _, _, err = readRecord(file, ms.tmpMsgBuf, false, ms.fstore.crcTable, ms.fstore.opts.DoCRC)
  			}
  		}
  		ms.unlockFiles(fslice)
  		if err != nil || msgIndex == nil {
  			return nil, err
  		}
  		// Recover this message
  		msg = &pb.MsgProto{}
  		err = msg.Unmarshal(ms.tmpMsgBuf[:msgIndex.msgSize])
  		if err != nil {
  			return nil, err
  		}
  		ms.cache.add(seq, msg, false)
  	}
  	return msg, nil
  }
docs: // lookup returns the message for the given sequence number, possibly
  // reading the message from disk.
  // Store write lock is assumed to be held on entry