LogSegment getPrevSegment(LogSegment segment) {
    LogSegmentName name = segment.getName();
    if (!segmentsByName.containsKey(name)) {
      throw new IllegalArgumentException("Invalid log segment name: " + name);
    }
    Map.Entry<LogSegmentName, LogSegment> prevEntry = segmentsByName.lowerEntry(name);
    return prevEntry == null ? null : prevEntry.getValue();
  }
Returns the {@link LogSegment} that is logically before the given {@code segment}.
@param segment the {@link LogSegment} whose "previous" segment is required.
@return the {@link LogSegment} that is logically before the given {@code segment}.
ambry-store/src/main/java/com/github/ambry/store/Log.java