private List<LogSegment> getSegmentsToLoad(File[] segmentFiles) throws StoreException {
    List<LogSegment> segments = new ArrayList<>(segmentFiles.length);
    for (File segmentFile : segmentFiles) {
      LogSegmentName name = LogSegmentName.fromFilename(segmentFile.getName());
      logger.info("Loading segment with name [{}]", name);
      LogSegment segment;
      if (name.isSingleSegment()) {
        // for backwards compatibility, a single segment log is loaded by providing capacity since the old logs have
        // no headers
        segment = new LogSegment(name, segmentFile, capacityInBytes, config, metrics, false);
      } else {
        segment = new LogSegment(name, segmentFile, config, metrics);
      }
      logger.info("Segment [{}] has capacity of {} bytes", name, segment.getCapacityInBytes());
      segments.add(segment);
    }
    return segments;
  }
Creates {@link LogSegment} instances from {@code segmentFiles}.
@param segmentFiles the files that form the segments of the log.
@return {@code List} of {@link LogSegment} instances corresponding to {@code segmentFiles}.
@throws StoreException if there is an I/O error loading the segment files or creating {@link LogSegment} instances.
ambry-store/src/main/java/com/github/ambry/store/Log.java