code: private void checkEntry(long index, Entry entry, Segment segment, Segment compactSegment) {
      // Get the entry compaction mode. If the compaction mode is DEFAULT apply the default compaction
      // mode to the entry.
      Compaction.Mode mode = entry.getCompactionMode();
      if (mode == Compaction.Mode.DEFAULT) {
        mode = defaultCompactionMode;
      }
  
      // According to the entry's compaction mode, either append the entry to the compact segment
      // or skip the entry in the compact segment (removing it from the resulting segment).
      switch (mode) {
        // SNAPSHOT entries are compacted if a snapshot has been taken at an index greater than the
        // entry's index.
        case SNAPSHOT:
          if (index <= snapshotIndex && !segment.isLive(index)) {
            compactEntry(index, segment, compactSegment);
          } else {
            transferEntry(index, entry, compactSegment);
          }
          break;
        // RELEASE and QUORUM entries are compacted if the entry has been released in the segment.
        case RELEASE:
        case QUORUM:
          if (!segment.isLive(index)) {
            compactEntry(index, segment, compactSegment);
          } else {
            transferEntry(index, entry, compactSegment);
          }
          break;
        // FULL entries are compacted if the major compact index is greater than the entry index
        // and the entry has been released.
        case FULL:
          if (index <= compactIndex && !segment.isLive(index)) {
            compactEntry(index, segment, compactSegment);
          } else {
            transferEntry(index, entry, compactSegment);
          }
          break;
        // SEQUENTIAL, EXPIRING, and TOMBSTONE entries can only be compacted during major compaction.
        // UNKNOWN entries can only be compacted during major compaction.
        case SEQUENTIAL:
        case EXPIRING:
        case TOMBSTONE:
        case UNKNOWN:
          transferEntry(index, entry, compactSegment);
          break;
        default:
          break;
      }
    }
docs: Compacts a command entry from a segment.