void compact(CompactionDetails details, byte[] bundleReadBuffer) throws IOException, StoreException {
    if (srcIndex == null) {
      throw new IllegalStateException("Compactor has not been initialized");
    } else if (compactionLog != null) {
      throw new IllegalStateException("There is already a compaction in progress");
    }
    srcMetrics.compactionIntervalInMin.mark(
        lastCompactionTimestampInSec == 0 ? 0 : (time.seconds() - lastCompactionTimestampInSec) / 60);
    lastCompactionTimestampInSec = time.seconds();

    checkSanity(details);
    logger.info("Compaction of {} started with details {}", storeId, details);
    currentCompactionDetails.set(details);
    short version = shouldPersistIndexSegmentOffsets ? CompactionLog.CURRENT_VERSION : CompactionLog.VERSION_1;
    compactionLog = new CompactionLog(dataDir.getAbsolutePath(), storeId, version, time, details, config);
    resumeCompaction(bundleReadBuffer);
  }
Compacts the store by copying valid data from the log segments in {@code details} to swap spaces and switching
the compacted segments out for the swap spaces. Returns once the compaction is complete.
@param details the {@link CompactionDetails} for the compaction.
@param bundleReadBuffer the preAllocated buffer for bundle read in compaction copy phase.
@throws IllegalArgumentException if any of the provided segments doesn't exist in the log or if one or more offsets
in the segments to compact are in the journal.
@throws IllegalStateException if the compactor has not been initialized.
@throws IOException if there were I/O errors creating the {@link CompactionLog}
@throws StoreException if there were exceptions reading to writing to store components.
ambry-store/src/main/java/com/github/ambry/store/BlobStoreCompactor.java