View Javadoc

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