code: func (ms *MemoryMsgStore) GetSequenceFromTimestamp(timestamp int64) (uint64, error) {
  	ms.RLock()
  	defer ms.RUnlock()
  
  	// No message ever stored
  	if ms.first == 0 {
  		return 0, nil
  	}
  	// All messages have expired
  	if ms.first > ms.last {
  		return ms.last + 1, nil
  	}
  	if timestamp <= ms.msgs[ms.first].Timestamp {
  		return ms.first, nil
  	}
  	if timestamp == ms.msgs[ms.last].Timestamp {
  		return ms.last, nil
  	}
  	if timestamp > ms.msgs[ms.last].Timestamp {
  		return ms.last + 1, nil
  	}
  
  	index := sort.Search(len(ms.msgs), func(i int) bool {
  		return ms.msgs[uint64(i)+ms.first].Timestamp >= timestamp
  	})
  
  	return uint64(index) + ms.first, nil
  }
docs: // GetSequenceFromTimestamp returns the sequence of the first message whose
  // timestamp is greater or equal to given timestamp.