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 java.io.IOException; 021import org.apache.hadoop.hbase.HBaseInterfaceAudience; 022import org.apache.hadoop.hbase.client.Get; 023import org.apache.hadoop.hbase.client.Scan; 024import org.apache.yetus.audience.InterfaceAudience; 025 026/** 027 * Special scanner, currently used for increment operations to allow additional server-side 028 * arguments for Scan operations. 029 * <p> 030 * Rather than adding new options/parameters to the public Scan API, this new class has been 031 * created. 032 * <p> 033 * Supports adding an option to only read from the MemStore with {@link #checkOnlyMemStore()} or to 034 * only read from StoreFiles with {@link #checkOnlyStoreFiles()}. 035 */ 036@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) 037public class InternalScan extends Scan { 038 private boolean memOnly = false; 039 private boolean filesOnly = false; 040 041 /** 042 * @param get get to model scan after 043 */ 044 public InternalScan(Get get) { 045 super(get); 046 } 047 048 /** 049 * @param scan - original scan object 050 */ 051 public InternalScan(Scan scan) throws IOException { 052 super(scan); 053 } 054 055 /** 056 * StoreFiles will not be scanned. Only MemStore will be scanned. 057 */ 058 public void checkOnlyMemStore() { 059 memOnly = true; 060 filesOnly = false; 061 } 062 063 /** 064 * MemStore will not be scanned. Only StoreFiles will be scanned. 065 */ 066 public void checkOnlyStoreFiles() { 067 memOnly = false; 068 filesOnly = true; 069 } 070 071 /** 072 * Returns true if only the MemStore should be checked. False if not. 073 * @return true to only check MemStore 074 */ 075 public boolean isCheckOnlyMemStore() { 076 return (memOnly); 077 } 078 079 /** 080 * Returns true if only StoreFiles should be checked. False if not. 081 * @return true if only check StoreFiles 082 */ 083 public boolean isCheckOnlyStoreFiles() { 084 return (filesOnly); 085 } 086}