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