View Javadoc

1   /**
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  package org.apache.hadoop.hbase.regionserver;
20  
21  import java.io.IOException;
22  
23  import org.apache.hadoop.hbase.HBaseInterfaceAudience;
24  import org.apache.hadoop.hbase.classification.InterfaceAudience;
25  import org.apache.hadoop.hbase.client.Get;
26  import org.apache.hadoop.hbase.client.Scan;
27  
28  /**
29   * Special scanner, currently used for increment operations to
30   * allow additional server-side arguments for Scan operations.
31   * <p>
32   * Rather than adding new options/parameters to the public Scan API, this new
33   * class has been created.
34   * <p>
35   * Supports adding an option to only read from the MemStore with
36   * {@link #checkOnlyMemStore()} or to only read from StoreFiles with
37   * {@link #checkOnlyStoreFiles()}.
38   */
39  @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
40  public class InternalScan extends Scan {
41    private boolean memOnly = false;
42    private boolean filesOnly = false;
43  
44    /**
45     * @param get get to model scan after
46     */
47    public InternalScan(Get get) {
48      super(get);
49    }
50  
51    /**
52     * @param scan - original scan object
53     * @throws IOException 
54     */
55    public InternalScan(Scan scan) 
56        throws IOException 
57    {
58      super(scan);
59    }
60    
61    /**
62     * StoreFiles will not be scanned. Only MemStore will be scanned.
63     */
64    public void checkOnlyMemStore() {
65      memOnly = true;
66      filesOnly = false;
67    }
68  
69    /**
70     * MemStore will not be scanned. Only StoreFiles will be scanned.
71     */
72    public void checkOnlyStoreFiles() {
73      memOnly = false;
74      filesOnly = true;
75    }
76  
77    /**
78     * Returns true if only the MemStore should be checked.  False if not.
79     * @return true to only check MemStore
80     */
81    public boolean isCheckOnlyMemStore() {
82      return (memOnly);
83    }
84  
85    /**
86     * Returns true if only StoreFiles should be checked.  False if not.
87     * @return true if only check StoreFiles
88     */
89    public boolean isCheckOnlyStoreFiles() {
90      return (filesOnly);
91    }
92  }