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;
019
020import org.apache.hadoop.hbase.HBaseInterfaceAudience;
021import org.apache.hadoop.hbase.KeepDeletedCells;
022import org.apache.yetus.audience.InterfaceAudience;
023import org.apache.yetus.audience.InterfaceStability;
024
025/**
026 * This class gives you the ability to change the max versions and TTL options before opening a
027 * scanner for a Store. And also gives you some information for the scan.
028 * <p>
029 * Changing max versions and TTL are usually safe even for flush/compaction, so here we provide a
030 * way to do it for you. If you want to do other complicated stuffs such as filtering, please wrap
031 * the {@link InternalScanner} in the {@code preCompact} and {@code preFlush} methods in
032 * {@link org.apache.hadoop.hbase.coprocessor.RegionObserver}.
033 * <p>
034 * For user scans, we also provide this class as a parameter in the {@code preStoreScannerOpen}
035 * method in {@link org.apache.hadoop.hbase.coprocessor.RegionObserver}. You can use it to change
036 * the inherent properties for a Store. For example, even if you use {@code Scan.readAllVersions},
037 * you still can not read two versions if the max versions property of the Store is one. You need to
038 * set the max versions to a value greater than two in {@code preStoreScannerOpen}.
039 * @see org.apache.hadoop.hbase.coprocessor.RegionObserver#preFlushScannerOpen(org.apache.hadoop.hbase.coprocessor.ObserverContext,
040 *      Store, ScanOptions, FlushLifeCycleTracker)
041 * @see org.apache.hadoop.hbase.coprocessor.RegionObserver#preCompactScannerOpen(org.apache.hadoop.hbase.coprocessor.ObserverContext,
042 *      Store, ScanType, ScanOptions,
043 *      org.apache.hadoop.hbase.regionserver.compactions.CompactionLifeCycleTracker,
044 *      org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest)
045 * @see org.apache.hadoop.hbase.coprocessor.RegionObserver#preStoreScannerOpen(org.apache.hadoop.hbase.coprocessor.ObserverContext,
046 *      Store, ScanOptions)
047 */
048@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
049@InterfaceStability.Evolving
050public interface ScanOptions {
051
052  int getMaxVersions();
053
054  void setMaxVersions(int maxVersions);
055
056  default void readAllVersions() {
057    setMaxVersions(Integer.MAX_VALUE);
058  }
059
060  long getTTL();
061
062  void setTTL(long ttl);
063
064  void setKeepDeletedCells(KeepDeletedCells keepDeletedCells);
065
066  KeepDeletedCells getKeepDeletedCells();
067}