Interface CompactionCandidateSearchPolicy

All Known Implementing Classes:
BaseCandidateSearchPolicy, FixedIntervalOrderPolicy, NewestSegmentFirstPolicy

public interface CompactionCandidateSearchPolicy
Policy used by CompactSegments duty to pick segments for compaction.
  • Method Details

    • compareCandidates

      int compareCandidates(CompactionCandidate candidateA, CompactionCandidate candidateB)
      Compares between two compaction candidates. Used to determine the order in which segments and intervals should be picked for compaction.
      Returns:
      A positive value if candidateA should be picked first, a negative value if candidateB should be picked first or zero if the order does not matter.
    • isEligibleForCompaction

      boolean isEligibleForCompaction(CompactionCandidate candidate, CompactionStatus currentCompactionStatus, CompactionTaskStatus latestTaskStatus)
      Checks if the given CompactionCandidate is eligible for compaction in the current iteration. A policy may implement this method to skip compacting intervals or segments that do not fulfil some required criteria.