001/**
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019package org.apache.hadoop.hbase.regionserver;
020
021import java.io.IOException;
022
023import org.apache.hadoop.hbase.HBaseInterfaceAudience;
024import org.apache.yetus.audience.InterfaceAudience;
025import org.apache.hadoop.hbase.client.Get;
026import org.apache.hadoop.hbase.client.Scan;
027
028/**
029 * Special scanner, currently used for increment operations to
030 * allow additional server-side arguments for Scan operations.
031 * <p>
032 * Rather than adding new options/parameters to the public Scan API, this new
033 * class has been created.
034 * <p>
035 * Supports adding an option to only read from the MemStore with
036 * {@link #checkOnlyMemStore()} or to only read from StoreFiles with
037 * {@link #checkOnlyStoreFiles()}.
038 */
039@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
040public class InternalScan extends Scan {
041  private boolean memOnly = false;
042  private boolean filesOnly = false;
043
044  /**
045   * @param get get to model scan after
046   */
047  public InternalScan(Get get) {
048    super(get);
049  }
050
051  /**
052   * @param scan - original scan object
053   * @throws IOException 
054   */
055  public InternalScan(Scan scan) 
056      throws IOException 
057  {
058    super(scan);
059  }
060  
061  /**
062   * StoreFiles will not be scanned. Only MemStore will be scanned.
063   */
064  public void checkOnlyMemStore() {
065    memOnly = true;
066    filesOnly = false;
067  }
068
069  /**
070   * MemStore will not be scanned. Only StoreFiles will be scanned.
071   */
072  public void checkOnlyStoreFiles() {
073    memOnly = false;
074    filesOnly = true;
075  }
076
077  /**
078   * Returns true if only the MemStore should be checked.  False if not.
079   * @return true to only check MemStore
080   */
081  public boolean isCheckOnlyMemStore() {
082    return (memOnly);
083  }
084
085  /**
086   * Returns true if only StoreFiles should be checked.  False if not.
087   * @return true if only check StoreFiles
088   */
089  public boolean isCheckOnlyStoreFiles() {
090    return (filesOnly);
091  }
092}