001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.regionserver.compactions;
019
020import org.apache.yetus.audience.InterfaceAudience;
021
022/**
023 * Base class for compaction window implementation.
024 */
025@InterfaceAudience.Private
026public abstract class CompactionWindow {
027
028  /**
029   * Compares the window to a timestamp.
030   * @param timestamp the timestamp to compare.
031   * @return a negative integer, zero, or a positive integer as the window lies before, covering, or
032   *         after than the timestamp.
033   */
034  public abstract int compareToTimestamp(long timestamp);
035
036  /**
037   * Move to the new window of the same tier or of the next tier, which represents an earlier time
038   * span.
039   * @return The next earlier window
040   */
041  public abstract CompactionWindow nextEarlierWindow();
042
043  /**
044   * Inclusive lower bound
045   */
046  public abstract long startMillis();
047
048  /**
049   * Exclusive upper bound
050   */
051  public abstract long endMillis();
052
053  @Override
054  public String toString() {
055    return "[" + startMillis() + ", " + endMillis() + ")";
056  }
057}